forked from mailru/go-clickhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers_test.go
38 lines (34 loc) · 997 Bytes
/
helpers_test.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
package clickhouse
import (
"reflect"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestColumnType(t *testing.T) {
testCases := []struct {
tt string
expected reflect.Type
}{
{"Int8", reflect.TypeOf(int8(0))},
{"Int16", reflect.TypeOf(int16(0))},
{"Int32", reflect.TypeOf(int32(0))},
{"Int64", reflect.TypeOf(int64(0))},
{"UInt8", reflect.TypeOf(uint8(0))},
{"UInt16", reflect.TypeOf(uint16(0))},
{"UInt32", reflect.TypeOf(uint32(0))},
{"UInt64", reflect.TypeOf(uint64(0))},
{"Float32", reflect.TypeOf(float32(0))},
{"Float64", reflect.TypeOf(float64(0))},
{"Date", reflect.TypeOf(time.Time{})},
{"DateTime", reflect.TypeOf(time.Time{})},
{"String", reflect.TypeOf("")},
{"FixedString(5)", reflect.TypeOf("")},
{"Enum8('one'=1)", reflect.TypeOf("")},
{"Enum16('one'=1)", reflect.TypeOf("")},
{"Array(UInt32)", reflect.TypeOf([]uint32{})},
}
for _, tc := range testCases {
assert.Equal(t, tc.expected, columnType(tc.tt))
}
}