diff --git a/builder/README.md b/builder/README.md index 9d0b636..07d73d0 100644 --- a/builder/README.md +++ b/builder/README.md @@ -286,7 +286,7 @@ sign: `BuildDelete(table string, where map[string]interface{}) (string, []interf If you use `Prepare && stmt.SomeMethods` then You have no need to worry about the safety. Prepare is a safety mechanism backed by `mysql`, it makes sql injection out of work. -So `builder` **doesn't** escape the string values it recieved -- it's unnecessary +So `builder` **doesn't** escape the string values it received -- it's unnecessary If you call `db.Query(cond, vals...)` directly, and you **don't** set `interpolateParams` which is one of the driver's variables to `true`, the driver actually will still prepare a stmt.So it's safe. diff --git a/builder/dao.go b/builder/dao.go index b56ebc8..c174fc1 100644 --- a/builder/dao.go +++ b/builder/dao.go @@ -229,7 +229,7 @@ func (bt Between) Build() ([]string, []interface{}) { } func betweenBuilder(bt map[string][]interface{}, notBetween bool) ([]string, []interface{}) { - if bt == nil || len(bt) == 0 { + if len(bt) == 0 { return nil, nil } var cond []string diff --git a/manager/README.md b/manager/README.md index d6984a9..d925d8a 100644 --- a/manager/README.md +++ b/manager/README.md @@ -56,7 +56,7 @@ Port sets the server port,default 3306 `func (o *Option) Set(sets ...Setting) *Option` -Set recieves a series of Set*-like functions +Set receives a series of Set*-like functions --- diff --git a/scanner/scanner_test.go b/scanner/scanner_test.go index 5a66ef9..2529513 100644 --- a/scanner/scanner_test.go +++ b/scanner/scanner_test.go @@ -419,7 +419,12 @@ func Test_Scan_Pointer(t *testing.T) { mp := map[string]interface{}{ "age": tc.in, } - bind(mp, &u) + err := bind(mp, &u) + if err == nil { + ass.NoError(err) + } else { + ass.Error(err) + } ass.Equal(tc.out, *u.Age, "case #%d fail", idx) } } @@ -428,10 +433,6 @@ func float64Ptr(v float64) *float64 { return &v } -func int64Ptr(v int64) *int64 { - return &v -} - func stringPtr(s string) *string { return &s } @@ -490,7 +491,12 @@ func Test_Scan_Multi_Pointer(t *testing.T) { ass := assert.New(t) for idx, tc := range testData { var u user - bind(tc.in, &u) + err := bind(tc.in, &u) + if err == nil { + ass.NoError(err) + } else { + ass.Error(err) + } ass.Equal(tc.out, u, "case #%d fail %+v", idx, u) } }