Skip to content

Commit

Permalink
补充测试
Browse files Browse the repository at this point in the history
  • Loading branch information
wln32 committed Mar 5, 2025
1 parent 9c458ba commit 4ac7359
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion util/gconv/gconv_z_unit_converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,34 @@ func TestNewConverter(t *testing.T) {
B sql.Null[float32]
C sql.NullInt64
D sql.NullString

E *sql.Null[int]
F *sql.Null[float32]
G *sql.NullInt64
H *sql.NullString
}
var dst sqlNullDst
err := conv.Struct(map[string]any{
"a": 12,
"b": 34,
"c": 56,
"d": "sqlNull",
"d": "sqlNullString",
"e": 12,
"f": 34,
"g": 56,
"h": "sqlNullString",
}, &dst, gconv.StructOption{})
t.AssertNil(err)
t.Assert(dst, sqlNullDst{
A: sql.Null[int]{V: 123456, Valid: true},
B: sql.Null[float32]{V: 123456, Valid: true},
C: sql.NullInt64{Int64: 123456, Valid: true},
D: sql.NullString{String: "123456", Valid: true},

E: &sql.Null[int]{V: 123456, Valid: true},
F: &sql.Null[float32]{V: 123456, Valid: true},
G: &sql.NullInt64{Int64: 123456, Valid: true},
H: &sql.NullString{String: "123456", Valid: true},
})
})
}

0 comments on commit 4ac7359

Please sign in to comment.