|
@@ -206,7 +206,7 @@ func TestUnmarshalRowString(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowStruct(t *testing.T) {
|
|
func TestUnmarshalRowStruct(t *testing.T) {
|
|
- var value = new(struct {
|
|
|
|
|
|
+ value := new(struct {
|
|
Name string
|
|
Name string
|
|
Age int
|
|
Age int
|
|
})
|
|
})
|
|
@@ -224,7 +224,7 @@ func TestUnmarshalRowStruct(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowStructWithTags(t *testing.T) {
|
|
func TestUnmarshalRowStructWithTags(t *testing.T) {
|
|
- var value = new(struct {
|
|
|
|
|
|
+ value := new(struct {
|
|
Age int `db:"age"`
|
|
Age int `db:"age"`
|
|
Name string `db:"name"`
|
|
Name string `db:"name"`
|
|
})
|
|
})
|
|
@@ -242,7 +242,7 @@ func TestUnmarshalRowStructWithTags(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowStructWithTagsWrongColumns(t *testing.T) {
|
|
func TestUnmarshalRowStructWithTagsWrongColumns(t *testing.T) {
|
|
- var value = new(struct {
|
|
|
|
|
|
+ value := new(struct {
|
|
Age *int `db:"age"`
|
|
Age *int `db:"age"`
|
|
Name string `db:"name"`
|
|
Name string `db:"name"`
|
|
})
|
|
})
|
|
@@ -259,7 +259,7 @@ func TestUnmarshalRowStructWithTagsWrongColumns(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsBool(t *testing.T) {
|
|
func TestUnmarshalRowsBool(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []bool{true, false}
|
|
|
|
|
|
+ expect := []bool{true, false}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("1\n0")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("1\n0")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -273,7 +273,7 @@ func TestUnmarshalRowsBool(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsInt(t *testing.T) {
|
|
func TestUnmarshalRowsInt(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []int{2, 3}
|
|
|
|
|
|
+ expect := []int{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -287,7 +287,7 @@ func TestUnmarshalRowsInt(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsInt8(t *testing.T) {
|
|
func TestUnmarshalRowsInt8(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []int8{2, 3}
|
|
|
|
|
|
+ expect := []int8{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -301,7 +301,7 @@ func TestUnmarshalRowsInt8(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsInt16(t *testing.T) {
|
|
func TestUnmarshalRowsInt16(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []int16{2, 3}
|
|
|
|
|
|
+ expect := []int16{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -315,7 +315,7 @@ func TestUnmarshalRowsInt16(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsInt32(t *testing.T) {
|
|
func TestUnmarshalRowsInt32(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []int32{2, 3}
|
|
|
|
|
|
+ expect := []int32{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -329,7 +329,7 @@ func TestUnmarshalRowsInt32(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsInt64(t *testing.T) {
|
|
func TestUnmarshalRowsInt64(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []int64{2, 3}
|
|
|
|
|
|
+ expect := []int64{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -343,7 +343,7 @@ func TestUnmarshalRowsInt64(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsUint(t *testing.T) {
|
|
func TestUnmarshalRowsUint(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []uint{2, 3}
|
|
|
|
|
|
+ expect := []uint{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -357,7 +357,7 @@ func TestUnmarshalRowsUint(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsUint8(t *testing.T) {
|
|
func TestUnmarshalRowsUint8(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []uint8{2, 3}
|
|
|
|
|
|
+ expect := []uint8{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -371,7 +371,7 @@ func TestUnmarshalRowsUint8(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsUint16(t *testing.T) {
|
|
func TestUnmarshalRowsUint16(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []uint16{2, 3}
|
|
|
|
|
|
+ expect := []uint16{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -385,7 +385,7 @@ func TestUnmarshalRowsUint16(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsUint32(t *testing.T) {
|
|
func TestUnmarshalRowsUint32(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []uint32{2, 3}
|
|
|
|
|
|
+ expect := []uint32{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -399,7 +399,7 @@ func TestUnmarshalRowsUint32(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsUint64(t *testing.T) {
|
|
func TestUnmarshalRowsUint64(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []uint64{2, 3}
|
|
|
|
|
|
+ expect := []uint64{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -413,7 +413,7 @@ func TestUnmarshalRowsUint64(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsFloat32(t *testing.T) {
|
|
func TestUnmarshalRowsFloat32(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []float32{2, 3}
|
|
|
|
|
|
+ expect := []float32{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -427,7 +427,7 @@ func TestUnmarshalRowsFloat32(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsFloat64(t *testing.T) {
|
|
func TestUnmarshalRowsFloat64(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []float64{2, 3}
|
|
|
|
|
|
+ expect := []float64{2, 3}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -441,7 +441,7 @@ func TestUnmarshalRowsFloat64(t *testing.T) {
|
|
|
|
|
|
func TestUnmarshalRowsString(t *testing.T) {
|
|
func TestUnmarshalRowsString(t *testing.T) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []string{"hello", "world"}
|
|
|
|
|
|
+ expect := []string{"hello", "world"}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("hello\nworld")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("hello\nworld")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -457,7 +457,7 @@ func TestUnmarshalRowsBoolPtr(t *testing.T) {
|
|
yes := true
|
|
yes := true
|
|
no := false
|
|
no := false
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*bool{&yes, &no}
|
|
|
|
|
|
+ expect := []*bool{&yes, &no}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("1\n0")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("1\n0")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -473,7 +473,7 @@ func TestUnmarshalRowsIntPtr(t *testing.T) {
|
|
two := 2
|
|
two := 2
|
|
three := 3
|
|
three := 3
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*int{&two, &three}
|
|
|
|
|
|
+ expect := []*int{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -489,7 +489,7 @@ func TestUnmarshalRowsInt8Ptr(t *testing.T) {
|
|
two := int8(2)
|
|
two := int8(2)
|
|
three := int8(3)
|
|
three := int8(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*int8{&two, &three}
|
|
|
|
|
|
+ expect := []*int8{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -505,7 +505,7 @@ func TestUnmarshalRowsInt16Ptr(t *testing.T) {
|
|
two := int16(2)
|
|
two := int16(2)
|
|
three := int16(3)
|
|
three := int16(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*int16{&two, &three}
|
|
|
|
|
|
+ expect := []*int16{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -521,7 +521,7 @@ func TestUnmarshalRowsInt32Ptr(t *testing.T) {
|
|
two := int32(2)
|
|
two := int32(2)
|
|
three := int32(3)
|
|
three := int32(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*int32{&two, &three}
|
|
|
|
|
|
+ expect := []*int32{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -537,7 +537,7 @@ func TestUnmarshalRowsInt64Ptr(t *testing.T) {
|
|
two := int64(2)
|
|
two := int64(2)
|
|
three := int64(3)
|
|
three := int64(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*int64{&two, &three}
|
|
|
|
|
|
+ expect := []*int64{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -553,7 +553,7 @@ func TestUnmarshalRowsUintPtr(t *testing.T) {
|
|
two := uint(2)
|
|
two := uint(2)
|
|
three := uint(3)
|
|
three := uint(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*uint{&two, &three}
|
|
|
|
|
|
+ expect := []*uint{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -569,7 +569,7 @@ func TestUnmarshalRowsUint8Ptr(t *testing.T) {
|
|
two := uint8(2)
|
|
two := uint8(2)
|
|
three := uint8(3)
|
|
three := uint8(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*uint8{&two, &three}
|
|
|
|
|
|
+ expect := []*uint8{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -585,7 +585,7 @@ func TestUnmarshalRowsUint16Ptr(t *testing.T) {
|
|
two := uint16(2)
|
|
two := uint16(2)
|
|
three := uint16(3)
|
|
three := uint16(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*uint16{&two, &three}
|
|
|
|
|
|
+ expect := []*uint16{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -601,7 +601,7 @@ func TestUnmarshalRowsUint32Ptr(t *testing.T) {
|
|
two := uint32(2)
|
|
two := uint32(2)
|
|
three := uint32(3)
|
|
three := uint32(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*uint32{&two, &three}
|
|
|
|
|
|
+ expect := []*uint32{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -617,7 +617,7 @@ func TestUnmarshalRowsUint64Ptr(t *testing.T) {
|
|
two := uint64(2)
|
|
two := uint64(2)
|
|
three := uint64(3)
|
|
three := uint64(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*uint64{&two, &three}
|
|
|
|
|
|
+ expect := []*uint64{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -633,7 +633,7 @@ func TestUnmarshalRowsFloat32Ptr(t *testing.T) {
|
|
two := float32(2)
|
|
two := float32(2)
|
|
three := float32(3)
|
|
three := float32(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*float32{&two, &three}
|
|
|
|
|
|
+ expect := []*float32{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -649,7 +649,7 @@ func TestUnmarshalRowsFloat64Ptr(t *testing.T) {
|
|
two := float64(2)
|
|
two := float64(2)
|
|
three := float64(3)
|
|
three := float64(3)
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*float64{&two, &three}
|
|
|
|
|
|
+ expect := []*float64{&two, &three}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("2\n3")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -665,7 +665,7 @@ func TestUnmarshalRowsStringPtr(t *testing.T) {
|
|
hello := "hello"
|
|
hello := "hello"
|
|
world := "world"
|
|
world := "world"
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
runOrmTest(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
|
|
- var expect = []*string{&hello, &world}
|
|
|
|
|
|
+ expect := []*string{&hello, &world}
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("hello\nworld")
|
|
rs := sqlmock.NewRows([]string{"value"}).FromCSVString("hello\nworld")
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
mock.ExpectQuery("select (.+) from users where user=?").WithArgs("anyone").WillReturnRows(rs)
|
|
|
|
|
|
@@ -678,7 +678,7 @@ func TestUnmarshalRowsStringPtr(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowsStruct(t *testing.T) {
|
|
func TestUnmarshalRowsStruct(t *testing.T) {
|
|
- var expect = []struct {
|
|
|
|
|
|
+ expect := []struct {
|
|
Name string
|
|
Name string
|
|
Age int64
|
|
Age int64
|
|
}{
|
|
}{
|
|
@@ -711,7 +711,7 @@ func TestUnmarshalRowsStruct(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowsStructWithNullStringType(t *testing.T) {
|
|
func TestUnmarshalRowsStructWithNullStringType(t *testing.T) {
|
|
- var expect = []struct {
|
|
|
|
|
|
+ expect := []struct {
|
|
Name string
|
|
Name string
|
|
NullString sql.NullString
|
|
NullString sql.NullString
|
|
}{
|
|
}{
|
|
@@ -752,7 +752,7 @@ func TestUnmarshalRowsStructWithNullStringType(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowsStructWithTags(t *testing.T) {
|
|
func TestUnmarshalRowsStructWithTags(t *testing.T) {
|
|
- var expect = []struct {
|
|
|
|
|
|
+ expect := []struct {
|
|
Name string
|
|
Name string
|
|
Age int64
|
|
Age int64
|
|
}{
|
|
}{
|
|
@@ -789,7 +789,7 @@ func TestUnmarshalRowsStructAndEmbeddedAnonymousStructWithTags(t *testing.T) {
|
|
Value int64 `db:"value"`
|
|
Value int64 `db:"value"`
|
|
}
|
|
}
|
|
|
|
|
|
- var expect = []struct {
|
|
|
|
|
|
+ expect := []struct {
|
|
Name string
|
|
Name string
|
|
Age int64
|
|
Age int64
|
|
Value int64
|
|
Value int64
|
|
@@ -831,7 +831,7 @@ func TestUnmarshalRowsStructAndEmbeddedStructPtrAnonymousWithTags(t *testing.T)
|
|
Value int64 `db:"value"`
|
|
Value int64 `db:"value"`
|
|
}
|
|
}
|
|
|
|
|
|
- var expect = []struct {
|
|
|
|
|
|
+ expect := []struct {
|
|
Name string
|
|
Name string
|
|
Age int64
|
|
Age int64
|
|
Value int64
|
|
Value int64
|
|
@@ -869,7 +869,7 @@ func TestUnmarshalRowsStructAndEmbeddedStructPtrAnonymousWithTags(t *testing.T)
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowsStructPtr(t *testing.T) {
|
|
func TestUnmarshalRowsStructPtr(t *testing.T) {
|
|
- var expect = []*struct {
|
|
|
|
|
|
+ expect := []*struct {
|
|
Name string
|
|
Name string
|
|
Age int64
|
|
Age int64
|
|
}{
|
|
}{
|
|
@@ -902,7 +902,7 @@ func TestUnmarshalRowsStructPtr(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowsStructWithTagsPtr(t *testing.T) {
|
|
func TestUnmarshalRowsStructWithTagsPtr(t *testing.T) {
|
|
- var expect = []*struct {
|
|
|
|
|
|
+ expect := []*struct {
|
|
Name string
|
|
Name string
|
|
Age int64
|
|
Age int64
|
|
}{
|
|
}{
|
|
@@ -935,7 +935,7 @@ func TestUnmarshalRowsStructWithTagsPtr(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
func TestUnmarshalRowsStructWithTagsPtrWithInnerPtr(t *testing.T) {
|
|
func TestUnmarshalRowsStructWithTagsPtrWithInnerPtr(t *testing.T) {
|
|
- var expect = []*struct {
|
|
|
|
|
|
+ expect := []*struct {
|
|
Name string
|
|
Name string
|
|
Age int64
|
|
Age int64
|
|
}{
|
|
}{
|