feat: formatter updated (#2780)

* feat: formatter updated

* feat: formatter updated with all int types
This commit is contained in:
Nityananda Gohain 2023-05-26 11:32:39 +05:30 committed by GitHub
parent b9c87c1395
commit 7f9c226175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,7 +144,7 @@ func ValidateAndCastValue(v interface{}, dataType v3.AttributeKeyDataType) (inte
// ClickHouseFormattedValue formats the value to be used in clickhouse query
func ClickHouseFormattedValue(v interface{}) string {
switch x := v.(type) {
case int:
case int, int8, int16, int32, int64:
return fmt.Sprintf("%d", x)
case float32, float64:
return fmt.Sprintf("%f", x)
@ -167,7 +167,7 @@ func ClickHouseFormattedValue(v interface{}) string {
}
str += "]"
return str
case int, float32, float64, bool:
case int, int8, int16, int32, int64, float32, float64, bool:
return strings.Join(strings.Fields(fmt.Sprint(x)), ",")
default:
zap.S().Error("invalid type for formatted value", zap.Any("type", reflect.TypeOf(x[0])))