Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn committed Feb 28, 2025
1 parent dd8817f commit dae543c
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 124 deletions.
125 changes: 63 additions & 62 deletions contrib/drivers/sqlite/sqlite_z_unit_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ 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 @@ -3988,14 +3989,14 @@ func Test_ScanList_NoRecreate_PtrAttribute(t *testing.T) {
)
r1 := gdb.Result{
gdb.Record{
"id": gdb.NewValue(1),
"name": gdb.NewValue("john"),
"age": gdb.NewValue(16),
"id": gvar.New(1),
"name": gvar.New("john"),
"age": gvar.New(16),
},
gdb.Record{
"id": gdb.NewValue(2),
"name": gdb.NewValue("smith"),
"age": gdb.NewValue(18),
"id": gvar.New(2),
"name": gvar.New("smith"),
"age": gvar.New(18),
},
}
err = r1.ScanList(&s, "One")
Expand All @@ -4008,12 +4009,12 @@ func Test_ScanList_NoRecreate_PtrAttribute(t *testing.T) {

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

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

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

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

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

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

0 comments on commit dae543c

Please sign in to comment.