Skip to content

Commit

Permalink
#79: Add nil type support for DML (#80)
Browse files Browse the repository at this point in the history
* #76: Add include keyword

* #79: Add nil data type on update + test
  • Loading branch information
arthurkushman authored Aug 14, 2022
1 parent 714baad commit 9bb7037
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ var rowsToUpdate = []struct {
insert map[string]interface{}
update map[string]interface{}
}{
{map[string]interface{}{"foo": "foo foo foo", "bar": "bar bar bar", "baz": 123}, map[string]interface{}{"foo": "foo changed"}},
{map[string]interface{}{"foo": "foo foo foo", "bar": "bar bar bar", "baz": 123}, map[string]interface{}{"foo": "foo changed", "baz": nil}},
}

func TestUpdate(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ func prepareBindings(data map[string]interface{}) (columns []string, values []in
values = append(values, strconv.FormatInt(v, 10))
case uint64:
values = append(values, strconv.FormatUint(v, 10))
case nil:
values = append(values, nil)
}

bindings = append(bindings, "$"+strconv.FormatInt(int64(i), 10))
Expand Down

0 comments on commit 9bb7037

Please sign in to comment.