Skip to content

just reduce/pretty code and set go version to go1.16+ in go.mod #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ _testmain.go
*.exe
tags
environ

.env
.envrc
8 changes: 4 additions & 4 deletions bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/go-sqlx/sqlx

go 1.10
go 1.16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the need for this. I feel that the library should continue to be compatible with the oldest version possible.

Edit: I'm not opposed to this if we were adding new functionality that would require an upgrade or if a new version of go were to drop inclusion of the deprecated functions.


require (
github.com/go-sql-driver/mysql v1.7.1
Expand Down
2 changes: 0 additions & 2 deletions named_context.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build go1.8

package sqlx

import (
Expand Down
2 changes: 0 additions & 2 deletions named_context_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build go1.8

package sqlx

import (
Expand Down
1 change: 0 additions & 1 deletion reflectx/reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
5 changes: 2 additions & 3 deletions sqlx.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"database/sql/driver"
"errors"
"fmt"

"io/ioutil"
"os"
"path/filepath"
"reflect"
"strings"
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 2 additions & 4 deletions sqlx_context.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// +build go1.8

package sqlx

import (
"context"
"database/sql"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
)
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 0 additions & 3 deletions sqlx_context_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.8
// +build go1.8

// The following environment variables, if set, will be used:
//
// - SQLX_SQLITE_DSN
Expand Down
5 changes: 2 additions & 3 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down