-
Notifications
You must be signed in to change notification settings - Fork 1
/
native.go
42 lines (40 loc) · 956 Bytes
/
native.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package bench
import (
"fmt"
"strconv"
)
func (c *FloatCol) AppendNativeTypeAssertion(row interface{}) error {
switch value := row.(type) {
case float32:
c.rows = append(c.rows, float64(value))
case float64:
c.rows = append(c.rows, float64(value))
case int:
c.rows = append(c.rows, float64(value))
case int8:
c.rows = append(c.rows, float64(value))
case int16:
c.rows = append(c.rows, float64(value))
case int32:
c.rows = append(c.rows, float64(value))
case int64:
c.rows = append(c.rows, float64(value))
case uint:
c.rows = append(c.rows, float64(value))
case uint8:
c.rows = append(c.rows, float64(value))
case uint16:
c.rows = append(c.rows, float64(value))
case uint32:
c.rows = append(c.rows, float64(value))
case uint64:
c.rows = append(c.rows, float64(value))
default:
num, err := strconv.ParseFloat(fmt.Sprint(row), 64)
if err != nil {
return err
}
c.rows = append(c.rows, num)
}
return nil
}