-
Notifications
You must be signed in to change notification settings - Fork 1
/
type.go
101 lines (95 loc) · 3.28 KB
/
type.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package duckdb
/*
#include <duckdb.h>
*/
import "C"
// Type wraps the corresponding DuckDB type enum.
type Type C.duckdb_type
const (
TYPE_INVALID Type = C.DUCKDB_TYPE_INVALID
TYPE_BOOLEAN Type = C.DUCKDB_TYPE_BOOLEAN
TYPE_TINYINT Type = C.DUCKDB_TYPE_TINYINT
TYPE_SMALLINT Type = C.DUCKDB_TYPE_SMALLINT
TYPE_INTEGER Type = C.DUCKDB_TYPE_INTEGER
TYPE_BIGINT Type = C.DUCKDB_TYPE_BIGINT
TYPE_UTINYINT Type = C.DUCKDB_TYPE_UTINYINT
TYPE_USMALLINT Type = C.DUCKDB_TYPE_USMALLINT
TYPE_UINTEGER Type = C.DUCKDB_TYPE_UINTEGER
TYPE_UBIGINT Type = C.DUCKDB_TYPE_UBIGINT
TYPE_FLOAT Type = C.DUCKDB_TYPE_FLOAT
TYPE_DOUBLE Type = C.DUCKDB_TYPE_DOUBLE
TYPE_TIMESTAMP Type = C.DUCKDB_TYPE_TIMESTAMP
TYPE_DATE Type = C.DUCKDB_TYPE_DATE
TYPE_TIME Type = C.DUCKDB_TYPE_TIME
TYPE_INTERVAL Type = C.DUCKDB_TYPE_INTERVAL
TYPE_HUGEINT Type = C.DUCKDB_TYPE_HUGEINT
TYPE_UHUGEINT Type = C.DUCKDB_TYPE_UHUGEINT
TYPE_VARCHAR Type = C.DUCKDB_TYPE_VARCHAR
TYPE_BLOB Type = C.DUCKDB_TYPE_BLOB
TYPE_DECIMAL Type = C.DUCKDB_TYPE_DECIMAL
TYPE_TIMESTAMP_S Type = C.DUCKDB_TYPE_TIMESTAMP_S
TYPE_TIMESTAMP_MS Type = C.DUCKDB_TYPE_TIMESTAMP_MS
TYPE_TIMESTAMP_NS Type = C.DUCKDB_TYPE_TIMESTAMP_NS
TYPE_ENUM Type = C.DUCKDB_TYPE_ENUM
TYPE_LIST Type = C.DUCKDB_TYPE_LIST
TYPE_STRUCT Type = C.DUCKDB_TYPE_STRUCT
TYPE_MAP Type = C.DUCKDB_TYPE_MAP
TYPE_ARRAY Type = C.DUCKDB_TYPE_ARRAY
TYPE_UUID Type = C.DUCKDB_TYPE_UUID
TYPE_UNION Type = C.DUCKDB_TYPE_UNION
TYPE_BIT Type = C.DUCKDB_TYPE_BIT
TYPE_TIME_TZ Type = C.DUCKDB_TYPE_TIME_TZ
TYPE_TIMESTAMP_TZ Type = C.DUCKDB_TYPE_TIMESTAMP_TZ
TYPE_ANY Type = C.DUCKDB_TYPE_ANY
TYPE_VARINT Type = C.DUCKDB_TYPE_VARINT
TYPE_SQLNULL Type = C.DUCKDB_TYPE_SQLNULL
)
// FIXME: Implement support for these types.
var unsupportedTypeToStringMap = map[Type]string{
TYPE_INVALID: "INVALID",
TYPE_UHUGEINT: "UHUGEINT",
TYPE_UNION: "UNION",
TYPE_BIT: "BIT",
TYPE_ANY: "ANY",
TYPE_VARINT: "VARINT",
}
var typeToStringMap = map[Type]string{
TYPE_INVALID: "INVALID",
TYPE_BOOLEAN: "BOOLEAN",
TYPE_TINYINT: "TINYINT",
TYPE_SMALLINT: "SMALLINT",
TYPE_INTEGER: "INTEGER",
TYPE_BIGINT: "BIGINT",
TYPE_UTINYINT: "UTINYINT",
TYPE_USMALLINT: "USMALLINT",
TYPE_UINTEGER: "UINTEGER",
TYPE_UBIGINT: "UBIGINT",
TYPE_FLOAT: "FLOAT",
TYPE_DOUBLE: "DOUBLE",
TYPE_TIMESTAMP: "TIMESTAMP",
TYPE_DATE: "DATE",
TYPE_TIME: "TIME",
TYPE_INTERVAL: "INTERVAL",
TYPE_HUGEINT: "HUGEINT",
TYPE_UHUGEINT: "UHUGEINT",
TYPE_VARCHAR: "VARCHAR",
TYPE_BLOB: "BLOB",
TYPE_DECIMAL: "DECIMAL",
TYPE_TIMESTAMP_S: "TIMESTAMP_S",
TYPE_TIMESTAMP_MS: "TIMESTAMP_MS",
TYPE_TIMESTAMP_NS: "TIMESTAMP_NS",
TYPE_ENUM: "ENUM",
TYPE_LIST: "LIST",
TYPE_STRUCT: "STRUCT",
TYPE_MAP: "MAP",
TYPE_ARRAY: "ARRAY",
TYPE_UUID: "UUID",
TYPE_UNION: "UNION",
TYPE_BIT: "BIT",
TYPE_TIME_TZ: "TIMETZ",
TYPE_TIMESTAMP_TZ: "TIMESTAMPTZ",
TYPE_ANY: "ANY",
TYPE_VARINT: "VARINT",
TYPE_SQLNULL: "SQLNULL",
}
const aliasJSON = "JSON"