Skip to content

Commit 4f8763e

Browse files
authored
Merge pull request #2 from jbuckmccready/uuid_support
2 parents 16927f2 + af330ab commit 4f8763e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

types.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
Byte QuestDBType = "byte"
1818
// 16-bit signed integer (-32768 to 32767)
1919
Short QuestDBType = "short"
20-
// 16-bit unicode charachter
20+
// 16-bit unicode character
2121
Char QuestDBType = "char"
2222
// 32-bit signed integer (0x80000000 to 0x7fffffff)
2323
Int QuestDBType = "int"
@@ -41,6 +41,8 @@ var (
4141
Double QuestDBType = "double"
4242
// byte array
4343
Binary QuestDBType = "binary"
44+
// hyphenated uuid string
45+
UUID QuestDBType = "uuid"
4446
// 256-bit unsigned integer
4547
// unsupported
4648
Long256 QuestDBType = "long256"
@@ -132,6 +134,13 @@ func serializeValue(v interface{}, qdbType QuestDBType) (string, error) {
132134
return "", fmt.Errorf("could not json marshal %T: %w", v, err)
133135
}
134136
return fmt.Sprintf("\"%s\"", base64.StdEncoding.EncodeToString(by)), nil
137+
case UUID:
138+
// sent in as a hyphenated uuid string
139+
switch val := v.(type) {
140+
case string:
141+
return fmt.Sprintf("\"%s\"", val), nil
142+
}
143+
135144
default:
136145
return "", fmt.Errorf("type %T is not compatible with %s", v, qdbType)
137146
}
@@ -153,6 +162,7 @@ var supportedQDBTypes = []QuestDBType{
153162
Double,
154163
Binary,
155164
JSON,
165+
UUID,
156166
// Long256,
157167
}
158168

0 commit comments

Comments
 (0)