diff --git a/libsql/internal/ws/websockets.go b/libsql/internal/ws/websockets.go index b43ff4f..6aba7b7 100644 --- a/libsql/internal/ws/websockets.go +++ b/libsql/internal/ws/websockets.go @@ -55,6 +55,13 @@ func convertValue(v any) (map[string]interface{}, error) { } else if float, ok := v.(float64); ok { res["type"] = "float" res["value"] = float + } else if boolean, ok := v.(bool); ok { + res["type"] = "integer" + if boolean { + res["value"] = "1" + } else { + res["value"] = "0" + } } else { return nil, fmt.Errorf("unsupported value type: %s", v) } diff --git a/libsql/internal/ws/websockets_test.go b/libsql/internal/ws/websockets_test.go index c831b38..924d591 100644 --- a/libsql/internal/ws/websockets_test.go +++ b/libsql/internal/ws/websockets_test.go @@ -58,6 +58,24 @@ func TestConvertValue(t *testing.T) { }, err: nil, }, + { + name: "boolean_true", + value: true, + want: map[string]any{ + "type": "integer", + "value": "1", + }, + err: nil, + }, + { + name: "boolean_false", + value: false, + want: map[string]any{ + "type": "integer", + "value": "0", + }, + err: nil, + }, { name: "unsupported", value: struct{}{},