Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
Byte QuestDBType = "byte"
// 16-bit signed integer (-32768 to 32767)
Short QuestDBType = "short"
// 16-bit unicode charachter
// 16-bit unicode character
Char QuestDBType = "char"
// 32-bit signed integer (0x80000000 to 0x7fffffff)
Int QuestDBType = "int"
Expand All @@ -41,6 +41,8 @@ var (
Double QuestDBType = "double"
// byte array
Binary QuestDBType = "binary"
// hyphenated uuid string
UUID QuestDBType = "uuid"
// 256-bit unsigned integer
// unsupported
Long256 QuestDBType = "long256"
Expand Down Expand Up @@ -132,6 +134,13 @@ func serializeValue(v interface{}, qdbType QuestDBType) (string, error) {
return "", fmt.Errorf("could not json marshal %T: %w", v, err)
}
return fmt.Sprintf("\"%s\"", base64.StdEncoding.EncodeToString(by)), nil
case UUID:
// sent in as a hyphenated uuid string
switch val := v.(type) {
case string:
return fmt.Sprintf("\"%s\"", val), nil
}

default:
return "", fmt.Errorf("type %T is not compatible with %s", v, qdbType)
}
Expand All @@ -153,6 +162,7 @@ var supportedQDBTypes = []QuestDBType{
Double,
Binary,
JSON,
UUID,
// Long256,
}

Expand Down