diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 276890d..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,15 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/DATA-DOG/go-sqlmock" - packages = ["."] - revision = "d76b18b42f285b792bf985118980ce9eacea9d10" - version = "v1.3.0" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "988d3551024f0c7c7eb0c26b50b95e2f2d9ac8d7e71f35f5e3b226afc317987f" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 8b3f987..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,26 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - - -[[constraint]] - name = "github.com/DATA-DOG/go-sqlmock" - version = "~1.3.0" diff --git a/dump.go b/dump.go index a5f09b4..b3f5f4c 100644 --- a/dump.go +++ b/dump.go @@ -41,7 +41,6 @@ type table struct { data *Data rows *sql.Rows - types []reflect.Type values []interface{} } @@ -53,7 +52,7 @@ type metaData struct { const ( // Version of this plugin for easy reference - Version = "0.5.0" + Version = "0.5.1" defaultMaxAllowedPacket = 4194304 ) @@ -302,7 +301,7 @@ func (table *table) CreateSQL() (string, error) { } func (table *table) Init() (err error) { - if len(table.types) != 0 { + if len(table.values) != 0 { return errors.New("can't init twice") } @@ -324,22 +323,22 @@ func (table *table) Init() (err error) { return err } - table.types = make([]reflect.Type, len(tt)) + var t reflect.Type table.values = make([]interface{}, len(tt)) for i, tp := range tt { st := tp.ScanType() if tp.DatabaseTypeName() == "BLOB" { - table.types[i] = reflect.TypeOf(sql.RawBytes{}) + t = reflect.TypeOf(sql.RawBytes{}) } else if st != nil && (st.Kind() == reflect.Int || st.Kind() == reflect.Int8 || st.Kind() == reflect.Int16 || st.Kind() == reflect.Int32 || st.Kind() == reflect.Int64) { - table.types[i] = reflect.TypeOf(sql.NullInt64{}) + t = reflect.TypeOf(sql.NullInt64{}) } else { - table.types[i] = reflect.TypeOf(sql.NullString{}) + t = reflect.TypeOf(sql.NullString{}) } - table.values[i] = reflect.New(table.types[i]).Interface() + table.values[i] = reflect.New(t).Interface() } return nil }