-
Notifications
You must be signed in to change notification settings - Fork 279
/
data-type-node.ts
56 lines (51 loc) · 1.03 KB
/
data-type-node.ts
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
import { freeze } from '../util/object-utils.js'
import { OperationNode } from './operation-node.js'
export type ColumnDataType =
| 'varchar'
| `varchar(${number})`
| 'text'
| 'integer'
| 'int2'
| 'int4'
| 'int8'
| 'bigint'
| 'boolean'
| 'real'
| 'double precision'
| 'float4'
| 'float8'
| 'decimal'
| `decimal(${number}, ${number})`
| 'numeric'
| `numeric(${number}, ${number})`
| 'binary'
| 'date'
| 'datetime'
| 'time'
| 'timetz'
| 'timestamp'
| 'timestamptz'
| 'serial'
| 'bigserial'
| 'uuid'
| 'json'
| 'jsonb'
export type DataTypeParams = Omit<DataTypeNode, 'kind' | 'dataType'>
export interface DataTypeNode extends OperationNode {
readonly kind: 'DataTypeNode'
readonly dataType: ColumnDataType
}
/**
* @internal
*/
export const DataTypeNode = freeze({
is(node: OperationNode): node is DataTypeNode {
return node.kind === 'DataTypeNode'
},
create(dataType: ColumnDataType): DataTypeNode {
return freeze({
kind: 'DataTypeNode',
dataType,
})
},
})