mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 14:48:57 +08:00
feat: formatter updated (#2780)
* feat: formatter updated * feat: formatter updated with all int types
This commit is contained in:
parent
b9c87c1395
commit
7f9c226175
@ -144,7 +144,7 @@ func ValidateAndCastValue(v interface{}, dataType v3.AttributeKeyDataType) (inte
|
|||||||
// ClickHouseFormattedValue formats the value to be used in clickhouse query
|
// ClickHouseFormattedValue formats the value to be used in clickhouse query
|
||||||
func ClickHouseFormattedValue(v interface{}) string {
|
func ClickHouseFormattedValue(v interface{}) string {
|
||||||
switch x := v.(type) {
|
switch x := v.(type) {
|
||||||
case int:
|
case int, int8, int16, int32, int64:
|
||||||
return fmt.Sprintf("%d", x)
|
return fmt.Sprintf("%d", x)
|
||||||
case float32, float64:
|
case float32, float64:
|
||||||
return fmt.Sprintf("%f", x)
|
return fmt.Sprintf("%f", x)
|
||||||
@ -167,7 +167,7 @@ func ClickHouseFormattedValue(v interface{}) string {
|
|||||||
}
|
}
|
||||||
str += "]"
|
str += "]"
|
||||||
return 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)), ",")
|
return strings.Join(strings.Fields(fmt.Sprint(x)), ",")
|
||||||
default:
|
default:
|
||||||
zap.S().Error("invalid type for formatted value", zap.Any("type", reflect.TypeOf(x[0])))
|
zap.S().Error("invalid type for formatted value", zap.Any("type", reflect.TypeOf(x[0])))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user