Skip to content

Commit e7718ac

Browse files
authored
add null to inser builder
1 parent 194e4e9 commit e7718ac

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cast_types.go

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ func castType(value any) (string, error) {
1818
return fmt.Sprintf("%v", v), nil
1919
case tsfuncs.TDEngineFunc:
2020
return v.String(), nil
21+
case nil:
22+
return "NULL", nil
2123
default:
2224
return "", fmt.Errorf("undefined type: %T", v)
2325
}

tsdbbuilder_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func Test_Insert(t *testing.T) {
6060
Columns("column_1", "column_2", "column_3").
6161
Values(1, 2, tsfuncs.Now()).
6262
Values(1, 2, tsfuncs.Abs("4321")).
63-
Values(1, 2, 3)
63+
Values(1, 2, nil)
6464

6565
// add table 2
6666
b.AddTable("test_table_2").

0 commit comments

Comments
 (0)