Skip to content

Commit

Permalink
Go: Add support for bool type (#1114)
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Jastrzebski <[email protected]>
  • Loading branch information
haaawk authored Feb 29, 2024
1 parent db894cb commit 213c7da
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bindings/go/libsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ func (c *conn) execute(query string, args []sqldriver.NamedValue) (C.libsql_rows
C.free(unsafe.Pointer(valueStr))
case nil:
statusCode = C.libsql_bind_null(stmt, C.int(idx), &errMsg)
case bool:
var valueInt int
if arg.Value.(bool) {
valueInt = 1
} else {
valueInt = 0
}
statusCode = C.libsql_bind_int(stmt, C.int(idx), C.longlong(valueInt), &errMsg)
default:
return nil, fmt.Errorf("unsupported type %T", arg.Value)
}
Expand Down

0 comments on commit 213c7da

Please sign in to comment.