-
Notifications
You must be signed in to change notification settings - Fork 1
/
legacy_mappings.go
39 lines (37 loc) · 1.33 KB
/
legacy_mappings.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
package redshift
var legacyColumnTypeMappings = map[string]string{
"int": "int",
"int2": "int",
"int4": "int",
"int8": "int",
"integer": "int",
"smallint": "int",
"bigint": "int",
"real": "float",
"float": "float",
"float4": "float",
"float8": "float",
"numeric": "float",
"double precision": "float",
"boolean": "boolean",
"bool": "boolean",
"text": "string",
"varchar": "string",
"character varying": "string",
"nchar": "string",
"bpchar": "string",
"character": "string",
"nvarchar": "string",
"string": "string",
"date": "datetime",
"timestamp without time zone": "datetime",
"timestamp with time zone": "datetime",
}
// legacyJsonRowMapper maps a row's scanned column to a json object's field
func legacyJsonRowMapper(databaseTypeName string, value any) any {
switch v := value.(type) {
case []byte:
return string(v)
}
return value
}