sirius/internal/model/utils.go
2023-04-17 12:00:34 +10:00

23 lines
405 B
Go

package model
func InterToArray(inp []interface{}) ([]int64, []bool, []string, []interface{}) {
var i []int64
var b []bool
var s []string
var a []interface{}
for _, v1 := range inp {
switch v2 := v1.(type) {
case float64:
i = append(i, int64(v2))
case bool:
b = append(b, bool(v2))
case string:
s = append(s, string(v2))
default:
a = append(a, v2)
}
}
return i, b, s, a
}