-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdbtypemap.go
120 lines (99 loc) · 2.53 KB
/
dbtypemap.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package dsunit
var dbTypeMappings map[string]map[string]string
func loadDefaultDbMappings() {
dbTypeMappings = map[string]map[string]string{"bigquery": {
"BIT": "BOOLEAN",
"BOOLEAN": "BOOLEAN",
"TINYINT": "BOOLEAN",
"INT": "INT64",
"INT64": "INT64",
"INTEGER": "INT64",
"SMALLINT": "INT64",
"BIGINT": "INT64",
"DECIMAL": "FLOAT64",
"NUMERIC": "FLOAT64",
"FLOAT": "FLOAT64",
"FLOAT64": "FLOAT64",
"NUMBER": "NUMERIC",
"CHAR": "STRING",
"STRING": "STRING",
"VARCHAR": "STRING",
"VARCHAR2": "STRING",
"CLOB": "STRING",
"TEXT": "STRING",
"DATE": "TIMESTAMP",
"DATETIME": "TIMESTAMP",
"TIMESTAMP": "TIMESTAMP",
"TIMESTAMPTZ": "TIMESTAMP",
},
"mysql": {
"BOOLEAN": "TINYINT",
"TINYINT": "TINYINT",
"BIT": "TINYINT",
"INT": "INT",
"INT64": "BIGINT",
"INTEGER": "BIGINT",
"SMALLINT": "SMALLINT",
"BIGINT": "BIGINT",
"DECIMAL": "DECIMAL(7,2)",
"NUMERIC": "DECIMAL(7,2)",
"FLOAT64": "DECIMAL(7,2)",
"FLOAT": "DECIMAL(7,2)",
"NUMBER": "DECIMAL(7,2)",
"CHAR": "VARCHAR(255)",
"VARCHAR": "VARCHAR(255)",
"STRING": "VARCHAR(255)",
"CLOB": "TEXT",
"TEXT": "TEXT",
"DATE": "DATE",
"DATETIME": "TIMESTAMP",
"TIMESTAMP": "TIMESTAMP",
"TIMESTAMPTZ": "TIMESTAMP",
},
"pq": {
"BOOLEAN": "BOOLEAN",
"BIT": "BOOLEAN",
"TINYINT": "BOOLEAN",
"INT": "INTEGER",
"INT64": "BIGINT",
"INTEGER": "INTEGER",
"SMALLINT": "SMALLINT",
"BIGINT": "BIGINT",
"DECIMAL": "NUMERIC(7,2)",
"NUMERIC": "NUMERIC(7,2)",
"FLOAT": "NUMERIC(7,2)",
"FLOAT64": "NUMERIC(7,2)",
"VARCHAR": "VARCHAR(255)",
"STRING": "VARCHAR(255)",
"CHAR": "VARCHAR(255)",
"CLOB": "TEXT",
"TEXT": "TEXT",
"TIMESTAMPTZ": "TIMESTAMPTZ",
"DATE": "TIMESTAMPTZ",
"TIMESTAMP": "TIMESTAMPTZ",
"DATETIME": "TIMESTAMPTZ",
},
"oracle": {
"TINYINT": "NUMBER(1)",
"BOOLEAN": "NUMBER(1)",
"BIT": "NUMBER(1)",
"INT": "NUMBER(7,0)",
"INTEGER": "NUMBER(7,0)",
"INT64": "NUMBER(14,0)",
"SMALLINT": "NUMBER(5,0)",
"BIGINT": "NUMBER(14,0)",
"FLOAT64": "NUMBER(7,2)",
"NUMERIC": "NUMBER(7,2)",
"FLOAT": "NUMBER(7,2)",
"CHAR": "VARCHAR2(255)",
"VARCHAR": "VARCHAR2(255)",
"STRING": "VARCHAR2(255)",
"TEXT": "VARCHAR2(255)",
"CLOB": "CLOB",
"DATE": "DATE",
"TIMESTAMPTZ": "TIMESTAMP",
"TIMESTAMP": "TIMESTAMP",
"DATETIME": "TIMESTAMP",
},
}
}