@@ -53,20 +53,21 @@ func Test_parseMysqlRowValues(t *testing.T) {
53
53
})
54
54
55
55
t .Run ("JSON Columns" , func (t * testing.T ) {
56
- values := []any {[]byte (`"Hello"` ), []byte (`true` ), []byte (`null` ), []byte (`42` ), []byte (`{"items": ["book", "pen"], "count": 2, "in_stock": true}` ), []byte (`[1,2,3]` )}
57
- columnNames := []string {"text_col" , "bool_col" , "null_col" , "int_col" , "json_col" , "array_col" }
58
- cTypes := []string {"json" , "json" , "json" , "json" , "json" , "json" }
56
+ values := []any {[]byte (`"Hello"` ), []byte (`true` ), []byte (`null` ), []byte (`42` ), []byte (`{"items": ["book", "pen"], "count": 2, "in_stock": true}` ), []byte (`[1,2,3]` ), nil }
57
+ columnNames := []string {"text_col" , "bool_col" , "null_col" , "int_col" , "json_col" , "array_col" , "nil_col" }
58
+ cTypes := []string {"json" , "json" , "json" , "json" , "json" , "json" , "json" }
59
59
60
60
result , err := parseMysqlRowValues (values , columnNames , cTypes )
61
61
require .NoError (t , err )
62
62
63
63
expected := map [string ]any {
64
64
"text_col" : "Hello" ,
65
65
"bool_col" : true ,
66
- "null_col" : nil ,
66
+ "null_col" : "null" ,
67
67
"int_col" : float64 (42 ),
68
68
"json_col" : map [string ]any {"items" : []any {"book" , "pen" }, "count" : float64 (2 ), "in_stock" : true },
69
69
"array_col" : []any {float64 (1 ), float64 (2 ), float64 (3 )},
70
+ "nil_col" : nil ,
70
71
}
71
72
require .Equal (t , expected , result )
72
73
})
0 commit comments