feat: bug-fix in ClickHouseFormattedValue to allow strings

This commit is contained in:
shivanshu 2024-08-27 18:28:52 +05:30
parent aabf364cc6
commit faa6fdfcde
No known key found for this signature in database
GPG Key ID: 0F9ACBC3AA12DC71

View File

@ -190,6 +190,19 @@ func ClickHouseFormattedValue(v interface{}) string {
zap.L().Error("invalid type for formatted value", zap.Any("type", reflect.TypeOf(x[0])))
return "[]"
}
case []string:
if len(x) == 0 {
return "[]"
}
str := "["
for idx, sVal := range x {
str += fmt.Sprintf("'%s'", QuoteEscapedString(sVal))
if idx != len(x)-1 {
str += ","
}
}
str += "]"
return str
default:
zap.L().Error("invalid type for formatted value", zap.Any("type", reflect.TypeOf(x)))
return ""