diff --git a/.gitignore b/.gitignore index b2be23c..8380c94 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ _testmain.go *.exe tags environ + +.env +.envrc diff --git a/bind.go b/bind.go index 33938bd..dafd998 100644 --- a/bind.go +++ b/bind.go @@ -22,10 +22,10 @@ const ( ) var defaultBinds = map[int][]string{ - DOLLAR: []string{"postgres", "pgx", "pgx/v4", "pgx/v5", "pq-timeouts", "cloudsqlpostgres", "ql", "nrpostgres", "cockroach"}, - QUESTION: []string{"mysql", "sqlite3", "nrmysql", "nrsqlite3"}, - NAMED: []string{"oci8", "ora", "goracle", "godror"}, - AT: []string{"sqlserver"}, + DOLLAR: {"postgres", "pgx", "pgx/v4", "pgx/v5", "pq-timeouts", "cloudsqlpostgres", "ql", "nrpostgres", "cockroach"}, + QUESTION: {"mysql", "sqlite3", "nrmysql", "nrsqlite3"}, + NAMED: {"oci8", "ora", "goracle", "godror"}, + AT: {"sqlserver"}, } var binds sync.Map diff --git a/doc.go b/doc.go index e2b4e60..b801041 100644 --- a/doc.go +++ b/doc.go @@ -8,5 +8,4 @@ // Additions include scanning into structs, named query support, rebinding // queries for different drivers, convenient shorthands for common error handling // and more. -// package sqlx diff --git a/go.mod b/go.mod index 89dc3b0..be0fdb4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/go-sqlx/sqlx -go 1.10 +go 1.16 require ( github.com/go-sql-driver/mysql v1.7.1 diff --git a/named_context.go b/named_context.go index 07ad216..336b067 100644 --- a/named_context.go +++ b/named_context.go @@ -1,5 +1,3 @@ -// +build go1.8 - package sqlx import ( diff --git a/named_context_test.go b/named_context_test.go index fd1d851..13a1681 100644 --- a/named_context_test.go +++ b/named_context_test.go @@ -1,5 +1,3 @@ -// +build go1.8 - package sqlx import ( diff --git a/reflectx/reflect.go b/reflectx/reflect.go index 0b10994..8ec6a13 100644 --- a/reflectx/reflect.go +++ b/reflectx/reflect.go @@ -3,7 +3,6 @@ // allows for Go-compatible named attribute access, including accessing embedded // struct attributes and the ability to use functions and struct tags to // customize field names. -// package reflectx import ( diff --git a/sqlx.go b/sqlx.go index 0b6fa39..4a72bed 100644 --- a/sqlx.go +++ b/sqlx.go @@ -5,8 +5,7 @@ import ( "database/sql/driver" "errors" "fmt" - - "io/ioutil" + "os" "path/filepath" "reflect" "strings" @@ -706,7 +705,7 @@ func LoadFile(e Execer, path string) (*sql.Result, error) { if err != nil { return nil, err } - contents, err := ioutil.ReadFile(realpath) + contents, err := os.ReadFile(realpath) if err != nil { return nil, err } diff --git a/sqlx_context.go b/sqlx_context.go index 7aa4dd0..e7ebda7 100644 --- a/sqlx_context.go +++ b/sqlx_context.go @@ -1,12 +1,10 @@ -// +build go1.8 - package sqlx import ( "context" "database/sql" "fmt" - "io/ioutil" + "os" "path/filepath" "reflect" ) @@ -99,7 +97,7 @@ func LoadFileContext(ctx context.Context, e ExecerContext, path string) (*sql.Re if err != nil { return nil, err } - contents, err := ioutil.ReadFile(realpath) + contents, err := os.ReadFile(realpath) if err != nil { return nil, err } diff --git a/sqlx_context_test.go b/sqlx_context_test.go index f349bd2..46fd914 100644 --- a/sqlx_context_test.go +++ b/sqlx_context_test.go @@ -1,6 +1,3 @@ -//go:build go1.8 -// +build go1.8 - // The following environment variables, if set, will be used: // // - SQLX_SQLITE_DSN diff --git a/types/types.go b/types/types.go index 808f583..99fc927 100644 --- a/types/types.go +++ b/types/types.go @@ -6,8 +6,7 @@ import ( "database/sql/driver" "encoding/json" "errors" - - "io/ioutil" + "io" ) // GzippedText is a []byte which transparently gzips data being submitted to @@ -43,7 +42,7 @@ func (g *GzippedText) Scan(src interface{}) error { return err } defer reader.Close() - b, err := ioutil.ReadAll(reader) + b, err := io.ReadAll(reader) if err != nil { return err }