Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn committed Jan 9, 2025
1 parent 73b5bfa commit da5fc0e
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 126 deletions.
125 changes: 62 additions & 63 deletions contrib/drivers/sqlite/sqlite_z_unit_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"github.com/gogf/gf/v2/container/garray"
"github.com/gogf/gf/v2/container/gmap"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gcode"
Expand Down Expand Up @@ -3989,14 +3988,14 @@ func Test_ScanList_NoRecreate_PtrAttribute(t *testing.T) {
)
r1 := gdb.Result{
gdb.Record{
"id": gvar.New(1),
"name": gvar.New("john"),
"age": gvar.New(16),
"id": gdb.NewValue(1),
"name": gdb.NewValue("john"),
"age": gdb.NewValue(16),
},
gdb.Record{
"id": gvar.New(2),
"name": gvar.New("smith"),
"age": gvar.New(18),
"id": gdb.NewValue(2),
"name": gdb.NewValue("smith"),
"age": gdb.NewValue(18),
},
}
err = r1.ScanList(&s, "One")
Expand All @@ -4009,12 +4008,12 @@ func Test_ScanList_NoRecreate_PtrAttribute(t *testing.T) {

r2 := gdb.Result{
gdb.Record{
"id": gvar.New(1),
"age": gvar.New(20),
"id": gdb.NewValue(1),
"age": gdb.NewValue(20),
},
gdb.Record{
"id": gvar.New(2),
"age": gvar.New(21),
"id": gdb.NewValue(2),
"age": gdb.NewValue(21),
},
}
err = r2.ScanList(&s, "One", "One", "id:Id")
Expand Down Expand Up @@ -4045,14 +4044,14 @@ func Test_ScanList_NoRecreate_StructAttribute(t *testing.T) {
)
r1 := gdb.Result{
gdb.Record{
"id": gvar.New(1),
"name": gvar.New("john"),
"age": gvar.New(16),
"id": gdb.NewValue(1),
"name": gdb.NewValue("john"),
"age": gdb.NewValue(16),
},
gdb.Record{
"id": gvar.New(2),
"name": gvar.New("smith"),
"age": gvar.New(18),
"id": gdb.NewValue(2),
"name": gdb.NewValue("smith"),
"age": gdb.NewValue(18),
},
}
err = r1.ScanList(&s, "One")
Expand All @@ -4065,12 +4064,12 @@ func Test_ScanList_NoRecreate_StructAttribute(t *testing.T) {

r2 := gdb.Result{
gdb.Record{
"id": gvar.New(1),
"age": gvar.New(20),
"id": gdb.NewValue(1),
"age": gdb.NewValue(20),
},
gdb.Record{
"id": gvar.New(2),
"age": gvar.New(21),
"id": gdb.NewValue(2),
"age": gdb.NewValue(21),
},
}
err = r2.ScanList(&s, "One", "One", "id:Id")
Expand Down Expand Up @@ -4109,14 +4108,14 @@ func Test_ScanList_NoRecreate_SliceAttribute_Ptr(t *testing.T) {
)
r1 := gdb.Result{
gdb.Record{
"id": gvar.New(1),
"name": gvar.New("john"),
"age": gvar.New(16),
"id": gdb.NewValue(1),
"name": gdb.NewValue("john"),
"age": gdb.NewValue(16),
},
gdb.Record{
"id": gvar.New(2),
"name": gvar.New("smith"),
"age": gvar.New(18),
"id": gdb.NewValue(2),
"name": gdb.NewValue("smith"),
"age": gdb.NewValue(18),
},
}
err = r1.ScanList(&s, "One")
Expand All @@ -4129,16 +4128,16 @@ func Test_ScanList_NoRecreate_SliceAttribute_Ptr(t *testing.T) {

r2 := gdb.Result{
gdb.Record{
"id": gvar.New(100),
"pid": gvar.New(1),
"age": gvar.New(30),
"name": gvar.New("john"),
"id": gdb.NewValue(100),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(30),
"name": gdb.NewValue("john"),
},
gdb.Record{
"id": gvar.New(200),
"pid": gvar.New(1),
"age": gvar.New(31),
"name": gvar.New("smith"),
"id": gdb.NewValue(200),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(31),
"name": gdb.NewValue("smith"),
},
}
err = r2.ScanList(&s, "Many", "One", "pid:Id")
Expand All @@ -4159,14 +4158,14 @@ func Test_ScanList_NoRecreate_SliceAttribute_Ptr(t *testing.T) {

r3 := gdb.Result{
gdb.Record{
"id": gvar.New(100),
"pid": gvar.New(1),
"age": gvar.New(40),
"id": gdb.NewValue(100),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(40),
},
gdb.Record{
"id": gvar.New(200),
"pid": gvar.New(1),
"age": gvar.New(41),
"id": gdb.NewValue(200),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(41),
},
}
err = r3.ScanList(&s, "Many", "One", "pid:Id")
Expand Down Expand Up @@ -4213,14 +4212,14 @@ func Test_ScanList_NoRecreate_SliceAttribute_Struct(t *testing.T) {
)
r1 := gdb.Result{
gdb.Record{
"id": gvar.New(1),
"name": gvar.New("john"),
"age": gvar.New(16),
"id": gdb.NewValue(1),
"name": gdb.NewValue("john"),
"age": gdb.NewValue(16),
},
gdb.Record{
"id": gvar.New(2),
"name": gvar.New("smith"),
"age": gvar.New(18),
"id": gdb.NewValue(2),
"name": gdb.NewValue("smith"),
"age": gdb.NewValue(18),
},
}
err = r1.ScanList(&s, "One")
Expand All @@ -4233,16 +4232,16 @@ func Test_ScanList_NoRecreate_SliceAttribute_Struct(t *testing.T) {

r2 := gdb.Result{
gdb.Record{
"id": gvar.New(100),
"pid": gvar.New(1),
"age": gvar.New(30),
"name": gvar.New("john"),
"id": gdb.NewValue(100),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(30),
"name": gdb.NewValue("john"),
},
gdb.Record{
"id": gvar.New(200),
"pid": gvar.New(1),
"age": gvar.New(31),
"name": gvar.New("smith"),
"id": gdb.NewValue(200),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(31),
"name": gdb.NewValue("smith"),
},
}
err = r2.ScanList(&s, "Many", "One", "pid:Id")
Expand All @@ -4263,14 +4262,14 @@ func Test_ScanList_NoRecreate_SliceAttribute_Struct(t *testing.T) {

r3 := gdb.Result{
gdb.Record{
"id": gvar.New(100),
"pid": gvar.New(1),
"age": gvar.New(40),
"id": gdb.NewValue(100),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(40),
},
gdb.Record{
"id": gvar.New(200),
"pid": gvar.New(1),
"age": gvar.New(41),
"id": gdb.NewValue(200),
"pid": gdb.NewValue(1),
"age": gdb.NewValue(41),
},
}
err = r3.ScanList(&s, "Many", "One", "pid:Id")
Expand Down Expand Up @@ -4301,8 +4300,8 @@ func TestResult_Structs1(t *testing.T) {
}
gtest.C(t, func(t *gtest.T) {
r := gdb.Result{
gdb.Record{"id": gvar.New(nil), "name": gvar.New("john")},
gdb.Record{"id": gvar.New(nil), "name": gvar.New("smith")},
gdb.Record{"id": gdb.NewValue(nil), "name": gdb.NewValue("john")},
gdb.Record{"id": gdb.NewValue(nil), "name": gdb.NewValue("smith")},
}
array := make([]*B, 2)
err := r.Structs(&array)
Expand Down
Loading

0 comments on commit da5fc0e

Please sign in to comment.