-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
constants.js
41 lines (39 loc) · 1.13 KB
/
constants.js
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
export const SERVER_CONSOLE_MODE = 'server';
export const INTEGER = 'integer';
export const SERIAL = 'serial';
export const BIGINT = 'bigint';
export const BIGSERIAL = 'bigserial';
export const UUID = 'uuid';
export const JSONDTYPE = 'json';
export const JSONB = 'jsonb';
export const TIMESTAMP = 'timestamp with time zone';
export const TIME = 'time with time zone';
export const NUMERIC = 'numeric';
export const DATE = 'date';
export const TIMETZ = 'timetz';
export const BOOLEAN = 'boolean';
export const getPlaceholder = type => {
switch (type) {
case 'integer':
return 'integer';
case 'bigint':
return 'BIG integer';
case 'numeric':
return 'float';
case 'timestamp with time zone':
return new Date().toISOString();
case 'date':
return new Date().toISOString().slice(0, 10);
case 'timetz':
const time = new Date().toISOString().slice(11, 19);
return `${time}Z or ${time}+05:30`;
case 'uuid':
return 'UUID';
case 'json':
return '{"name": "foo"} or [12, "bar"]';
case 'jsonb':
return '{"name": "foo"} or [12, "bar"]';
default:
return 'text';
}
};