[fix] struct 中存在slice字段会报错误
This commit is contained in:
+4
-2
@@ -67,9 +67,10 @@ func TestScanJsonFieldStruct(t *testing.T) {
|
||||
Id int `db:"id"`
|
||||
Code string `db:"code"`
|
||||
Map map[string]any `db:"map"`
|
||||
Arr []int64 `db:"arr"`
|
||||
}{}
|
||||
|
||||
myConn.Select(`select 0 as id, 'test' as code, '{"a":1}' as map`, []any{}, &dest)
|
||||
myConn.Select(`select 0 as id, 'test' as code, '{"a":1}' as map, '[3, 4]' as arr`, []any{}, &dest)
|
||||
|
||||
t.Log(dest)
|
||||
}
|
||||
@@ -92,9 +93,10 @@ func TestScanJsonFieldStructSlice(t *testing.T) {
|
||||
Id int `db:"id"`
|
||||
Code string `db:"code"`
|
||||
Map map[string]any `db:"map"`
|
||||
Arr []any `db:"arr"`
|
||||
}{}
|
||||
|
||||
myConn.Select(`select * from ((select 0 as id, 'test' as code, '{"a":1}' as map) union (select 1 as id, 'test1' as code, '{"a":2}' as map)) as t`, []any{}, &dest)
|
||||
myConn.Select(`select * from ((select 0 as id, 'test' as code, '{"a":1}' as map, '[1, 2]' as arr) union (select 1 as id, 'test1' as code, '{"a":2}' as map, '[1, 2]' as arr)) as t`, []any{}, &dest)
|
||||
|
||||
t.Log(dest)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user