postgrejs 2.22.7 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/{esm/connection → connection}/bind-param.js +2 -0
- package/{esm/connection → connection}/connection.js +4 -2
- package/{esm/connection → connection}/cursor.js +8 -3
- package/{esm/connection → connection}/intl-connection.js +6 -3
- package/{esm/connection → connection}/pool.js +4 -1
- package/{esm/connection → connection}/portal.js +3 -1
- package/{esm/connection → connection}/prepared-statement.js +6 -3
- package/{esm/constants.js → constants.js} +1 -1
- package/{esm/data-type-map.js → data-type-map.js} +2 -2
- package/package.json +13 -32
- package/{esm/protocol → protocol}/backend.js +1 -0
- package/{esm/protocol → protocol}/buffer-reader.js +2 -1
- package/{esm/protocol → protocol}/database-error.js +16 -0
- package/{esm/protocol → protocol}/frontend.js +1 -0
- package/{esm/protocol → protocol}/pg-socket.js +9 -3
- package/{types/protocol → protocol}/smart-buffer.d.ts +1 -0
- package/{esm/protocol → protocol}/smart-buffer.js +29 -19
- package/{esm/util → util}/bigint-methods.js +1 -0
- package/cjs/connection/bind-param.js +0 -10
- package/cjs/connection/connection.js +0 -295
- package/cjs/connection/cursor.js +0 -91
- package/cjs/connection/intl-connection.js +0 -258
- package/cjs/connection/pool.js +0 -236
- package/cjs/connection/portal.js +0 -157
- package/cjs/connection/prepared-statement.js +0 -226
- package/cjs/constants.js +0 -249
- package/cjs/data-type-map.js +0 -131
- package/cjs/data-types/bool-type.js +0 -33
- package/cjs/data-types/box-type.js +0 -52
- package/cjs/data-types/bytea-type.js +0 -28
- package/cjs/data-types/char-type.js +0 -27
- package/cjs/data-types/circle-type.js +0 -51
- package/cjs/data-types/date-type.js +0 -75
- package/cjs/data-types/float4-type.js +0 -25
- package/cjs/data-types/float8-type.js +0 -25
- package/cjs/data-types/int2-type.js +0 -26
- package/cjs/data-types/int2-vector-type.js +0 -42
- package/cjs/data-types/int4-type.js +0 -28
- package/cjs/data-types/int8-type.js +0 -36
- package/cjs/data-types/json-type.js +0 -40
- package/cjs/data-types/jsonb-type.js +0 -44
- package/cjs/data-types/lseg-type.js +0 -55
- package/cjs/data-types/numeric-type.js +0 -125
- package/cjs/data-types/oid-type.js +0 -32
- package/cjs/data-types/point-type.js +0 -42
- package/cjs/data-types/time-type.js +0 -66
- package/cjs/data-types/timestamp-type.js +0 -89
- package/cjs/data-types/timestamptz-type.js +0 -76
- package/cjs/data-types/uuid-type.js +0 -39
- package/cjs/data-types/varchar-type.js +0 -27
- package/cjs/index.js +0 -28
- package/cjs/interfaces/command-result.js +0 -2
- package/cjs/interfaces/data-mapping-options.js +0 -2
- package/cjs/interfaces/data-type.js +0 -2
- package/cjs/interfaces/database-connection-params.js +0 -2
- package/cjs/interfaces/field-info.js +0 -2
- package/cjs/interfaces/query-options.js +0 -2
- package/cjs/interfaces/query-result.js +0 -2
- package/cjs/interfaces/script-execute-options.js +0 -2
- package/cjs/interfaces/script-result.js +0 -2
- package/cjs/interfaces/statement-prepare-options.js +0 -2
- package/cjs/package.json +0 -3
- package/cjs/protocol/backend.js +0 -262
- package/cjs/protocol/buffer-reader.js +0 -78
- package/cjs/protocol/database-error.js +0 -17
- package/cjs/protocol/frontend.js +0 -255
- package/cjs/protocol/pg-socket.js +0 -367
- package/cjs/protocol/protocol.js +0 -71
- package/cjs/protocol/sasl.js +0 -108
- package/cjs/protocol/smart-buffer.js +0 -172
- package/cjs/safe-event-emitter.js +0 -17
- package/cjs/tsconfig-build-cjs.tsbuildinfo +0 -1
- package/cjs/types.js +0 -2
- package/cjs/util/array-calculatedim.js +0 -18
- package/cjs/util/bigint-methods.js +0 -44
- package/cjs/util/config-from-env.js +0 -29
- package/cjs/util/connection-config.js +0 -61
- package/cjs/util/convert-row-to-object.js +0 -12
- package/cjs/util/decode-binaryarray.js +0 -38
- package/cjs/util/encode-binaryarray.js +0 -44
- package/cjs/util/escape-literal.js +0 -26
- package/cjs/util/fast-parseint.js +0 -31
- package/cjs/util/get-parsers.js +0 -41
- package/cjs/util/parse-array.js +0 -60
- package/cjs/util/parse-datetime.js +0 -37
- package/cjs/util/parse-row.js +0 -11
- package/cjs/util/parse-time.js +0 -30
- package/cjs/util/stringify-arrayliteral.js +0 -37
- package/cjs/util/stringify-for-sql.js +0 -29
- package/cjs/util/wrap-row-description.js +0 -34
- package/esm/package.json +0 -3
- package/types/index.d.cts +0 -25
- /package/{types/connection → connection}/bind-param.d.ts +0 -0
- /package/{types/connection → connection}/connection.d.ts +0 -0
- /package/{types/connection → connection}/cursor.d.ts +0 -0
- /package/{types/connection → connection}/intl-connection.d.ts +0 -0
- /package/{types/connection → connection}/pool.d.ts +0 -0
- /package/{types/connection → connection}/portal.d.ts +0 -0
- /package/{types/connection → connection}/prepared-statement.d.ts +0 -0
- /package/{types/constants.d.ts → constants.d.ts} +0 -0
- /package/{types/data-type-map.d.ts → data-type-map.d.ts} +0 -0
- /package/{types/data-types → data-types}/bool-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/bool-type.js +0 -0
- /package/{types/data-types → data-types}/box-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/box-type.js +0 -0
- /package/{types/data-types → data-types}/bytea-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/bytea-type.js +0 -0
- /package/{types/data-types → data-types}/char-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/char-type.js +0 -0
- /package/{types/data-types → data-types}/circle-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/circle-type.js +0 -0
- /package/{types/data-types → data-types}/date-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/date-type.js +0 -0
- /package/{types/data-types → data-types}/float4-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/float4-type.js +0 -0
- /package/{types/data-types → data-types}/float8-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/float8-type.js +0 -0
- /package/{types/data-types → data-types}/int2-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/int2-type.js +0 -0
- /package/{types/data-types → data-types}/int2-vector-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/int2-vector-type.js +0 -0
- /package/{types/data-types → data-types}/int4-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/int4-type.js +0 -0
- /package/{types/data-types → data-types}/int8-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/int8-type.js +0 -0
- /package/{types/data-types → data-types}/json-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/json-type.js +0 -0
- /package/{types/data-types → data-types}/jsonb-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/jsonb-type.js +0 -0
- /package/{types/data-types → data-types}/lseg-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/lseg-type.js +0 -0
- /package/{types/data-types → data-types}/numeric-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/numeric-type.js +0 -0
- /package/{types/data-types → data-types}/oid-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/oid-type.js +0 -0
- /package/{types/data-types → data-types}/point-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/point-type.js +0 -0
- /package/{types/data-types → data-types}/time-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/time-type.js +0 -0
- /package/{types/data-types → data-types}/timestamp-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/timestamp-type.js +0 -0
- /package/{types/data-types → data-types}/timestamptz-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/timestamptz-type.js +0 -0
- /package/{types/data-types → data-types}/uuid-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/uuid-type.js +0 -0
- /package/{types/data-types → data-types}/varchar-type.d.ts +0 -0
- /package/{esm/data-types → data-types}/varchar-type.js +0 -0
- /package/{types/index.d.ts → index.d.ts} +0 -0
- /package/{esm/index.js → index.js} +0 -0
- /package/{types/interfaces → interfaces}/command-result.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/command-result.js +0 -0
- /package/{types/interfaces → interfaces}/data-mapping-options.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/data-mapping-options.js +0 -0
- /package/{types/interfaces → interfaces}/data-type.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/data-type.js +0 -0
- /package/{types/interfaces → interfaces}/database-connection-params.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/database-connection-params.js +0 -0
- /package/{types/interfaces → interfaces}/field-info.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/field-info.js +0 -0
- /package/{types/interfaces → interfaces}/query-options.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/query-options.js +0 -0
- /package/{types/interfaces → interfaces}/query-result.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/query-result.js +0 -0
- /package/{types/interfaces → interfaces}/script-execute-options.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/script-execute-options.js +0 -0
- /package/{types/interfaces → interfaces}/script-result.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/script-result.js +0 -0
- /package/{types/interfaces → interfaces}/statement-prepare-options.d.ts +0 -0
- /package/{esm/interfaces → interfaces}/statement-prepare-options.js +0 -0
- /package/{types/protocol → protocol}/backend.d.ts +0 -0
- /package/{types/protocol → protocol}/buffer-reader.d.ts +0 -0
- /package/{types/protocol → protocol}/database-error.d.ts +0 -0
- /package/{types/protocol → protocol}/frontend.d.ts +0 -0
- /package/{types/protocol → protocol}/pg-socket.d.ts +0 -0
- /package/{types/protocol → protocol}/protocol.d.ts +0 -0
- /package/{esm/protocol → protocol}/protocol.js +0 -0
- /package/{types/protocol → protocol}/sasl.d.ts +0 -0
- /package/{esm/protocol → protocol}/sasl.js +0 -0
- /package/{types/safe-event-emitter.d.ts → safe-event-emitter.d.ts} +0 -0
- /package/{esm/safe-event-emitter.js → safe-event-emitter.js} +0 -0
- /package/{types/types.d.ts → types.d.ts} +0 -0
- /package/{esm/types.js → types.js} +0 -0
- /package/{types/util → util}/array-calculatedim.d.ts +0 -0
- /package/{esm/util → util}/array-calculatedim.js +0 -0
- /package/{types/util → util}/bigint-methods.d.ts +0 -0
- /package/{types/util → util}/config-from-env.d.ts +0 -0
- /package/{esm/util → util}/config-from-env.js +0 -0
- /package/{types/util → util}/connection-config.d.ts +0 -0
- /package/{esm/util → util}/connection-config.js +0 -0
- /package/{types/util → util}/convert-row-to-object.d.ts +0 -0
- /package/{esm/util → util}/convert-row-to-object.js +0 -0
- /package/{types/util → util}/decode-binaryarray.d.ts +0 -0
- /package/{esm/util → util}/decode-binaryarray.js +0 -0
- /package/{types/util → util}/encode-binaryarray.d.ts +0 -0
- /package/{esm/util → util}/encode-binaryarray.js +0 -0
- /package/{types/util → util}/escape-literal.d.ts +0 -0
- /package/{esm/util → util}/escape-literal.js +0 -0
- /package/{types/util → util}/fast-parseint.d.ts +0 -0
- /package/{esm/util → util}/fast-parseint.js +0 -0
- /package/{types/util → util}/get-parsers.d.ts +0 -0
- /package/{esm/util → util}/get-parsers.js +0 -0
- /package/{types/util → util}/parse-array.d.ts +0 -0
- /package/{esm/util → util}/parse-array.js +0 -0
- /package/{types/util → util}/parse-datetime.d.ts +0 -0
- /package/{esm/util → util}/parse-datetime.js +0 -0
- /package/{types/util → util}/parse-row.d.ts +0 -0
- /package/{esm/util → util}/parse-row.js +0 -0
- /package/{types/util → util}/parse-time.d.ts +0 -0
- /package/{esm/util → util}/parse-time.js +0 -0
- /package/{types/util → util}/stringify-arrayliteral.d.ts +0 -0
- /package/{esm/util → util}/stringify-arrayliteral.js +0 -0
- /package/{types/util → util}/stringify-for-sql.d.ts +0 -0
- /package/{esm/util → util}/stringify-for-sql.js +0 -0
- /package/{types/util → util}/wrap-row-description.d.ts +0 -0
- /package/{esm/util → util}/wrap-row-description.js +0 -0
package/cjs/constants.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataTypeNames = exports.DataTypeOIDs = exports.ConnectionState = exports.DEFAULT_COLUMN_FORMAT = exports.DataFormat = void 0;
|
|
4
|
-
const protocol_js_1 = require("./protocol/protocol.js");
|
|
5
|
-
var DataFormat = protocol_js_1.Protocol.DataFormat;
|
|
6
|
-
exports.DataFormat = DataFormat;
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
Symbol.asyncDispose ?? (Symbol.asyncDispose = Symbol('Symbol.asyncDispose'));
|
|
9
|
-
exports.DEFAULT_COLUMN_FORMAT = DataFormat.binary;
|
|
10
|
-
var ConnectionState;
|
|
11
|
-
(function (ConnectionState) {
|
|
12
|
-
ConnectionState[ConnectionState["CLOSED"] = 0] = "CLOSED";
|
|
13
|
-
ConnectionState[ConnectionState["CONNECTING"] = 1] = "CONNECTING";
|
|
14
|
-
ConnectionState[ConnectionState["AUTHORIZING"] = 3] = "AUTHORIZING";
|
|
15
|
-
ConnectionState[ConnectionState["READY"] = 2] = "READY";
|
|
16
|
-
ConnectionState[ConnectionState["CLOSING"] = 10] = "CLOSING";
|
|
17
|
-
})(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
|
|
18
|
-
exports.DataTypeOIDs = {
|
|
19
|
-
bool: 16,
|
|
20
|
-
bytea: 17,
|
|
21
|
-
char: 18,
|
|
22
|
-
name: 19,
|
|
23
|
-
int8: 20,
|
|
24
|
-
int2: 21,
|
|
25
|
-
int2vector: 22,
|
|
26
|
-
int4: 23,
|
|
27
|
-
regproc: 24,
|
|
28
|
-
text: 25,
|
|
29
|
-
oid: 26,
|
|
30
|
-
tid: 27,
|
|
31
|
-
xid: 28,
|
|
32
|
-
cid: 29,
|
|
33
|
-
oidvector: 30,
|
|
34
|
-
json: 114,
|
|
35
|
-
xml: 142,
|
|
36
|
-
point: 600,
|
|
37
|
-
lseg: 601,
|
|
38
|
-
path: 602,
|
|
39
|
-
box: 603,
|
|
40
|
-
polygon: 604,
|
|
41
|
-
line: 628,
|
|
42
|
-
cidr: 650,
|
|
43
|
-
float4: 700,
|
|
44
|
-
float8: 701,
|
|
45
|
-
unknown: 705,
|
|
46
|
-
circle: 718,
|
|
47
|
-
macaddr8: 774,
|
|
48
|
-
money: 790,
|
|
49
|
-
macaddr: 829,
|
|
50
|
-
inet: 869,
|
|
51
|
-
bpchar: 1042,
|
|
52
|
-
varchar: 1043,
|
|
53
|
-
date: 1082,
|
|
54
|
-
time: 1083,
|
|
55
|
-
timestamp: 1114,
|
|
56
|
-
timestamptz: 1184,
|
|
57
|
-
interval: 1186,
|
|
58
|
-
timetz: 1266,
|
|
59
|
-
bit: 1560,
|
|
60
|
-
varbit: 1562,
|
|
61
|
-
numeric: 1700,
|
|
62
|
-
refcursor: 1790,
|
|
63
|
-
regprocedure: 2202,
|
|
64
|
-
regoper: 2203,
|
|
65
|
-
regoperator: 2204,
|
|
66
|
-
regclass: 2205,
|
|
67
|
-
regtype: 2206,
|
|
68
|
-
record: 2249,
|
|
69
|
-
cstring: 2275,
|
|
70
|
-
any: 2276,
|
|
71
|
-
anyarray: 2277,
|
|
72
|
-
void: 2278,
|
|
73
|
-
trigger: 2279,
|
|
74
|
-
language_handler: 2280,
|
|
75
|
-
internal: 2281,
|
|
76
|
-
anyelement: 2283,
|
|
77
|
-
anynonarray: 2776,
|
|
78
|
-
uuid: 2950,
|
|
79
|
-
jsonb: 3802,
|
|
80
|
-
anyrange: 3831,
|
|
81
|
-
int4range: 3904,
|
|
82
|
-
numrange: 3906,
|
|
83
|
-
tsrange: 3908,
|
|
84
|
-
rstzrange: 3910,
|
|
85
|
-
daterange: 3912,
|
|
86
|
-
int8range: 3926,
|
|
87
|
-
_xml: 143,
|
|
88
|
-
_json: 199,
|
|
89
|
-
_xid8: 271,
|
|
90
|
-
_line: 629,
|
|
91
|
-
_cidr: 651,
|
|
92
|
-
_circle: 719,
|
|
93
|
-
_macaddr8: 775,
|
|
94
|
-
_money: 791,
|
|
95
|
-
_bool: 1000,
|
|
96
|
-
_bytea: 1001,
|
|
97
|
-
_char: 1002,
|
|
98
|
-
_name: 1003,
|
|
99
|
-
_int2: 1005,
|
|
100
|
-
_int2vector: 1006,
|
|
101
|
-
_int4: 1007,
|
|
102
|
-
_regproc: 1008,
|
|
103
|
-
_text: 1009,
|
|
104
|
-
_tid: 1010,
|
|
105
|
-
_xid: 1011,
|
|
106
|
-
_cid: 1012,
|
|
107
|
-
_oidvector: 1013,
|
|
108
|
-
_bpchar: 1014,
|
|
109
|
-
_varchar: 1015,
|
|
110
|
-
_int8: 1016,
|
|
111
|
-
_point: 1017,
|
|
112
|
-
_lseg: 1018,
|
|
113
|
-
_path: 1019,
|
|
114
|
-
_box: 1020,
|
|
115
|
-
_float4: 1021,
|
|
116
|
-
_float8: 1022,
|
|
117
|
-
_polygon: 1027,
|
|
118
|
-
_oid: 1028,
|
|
119
|
-
_macaddr: 1040,
|
|
120
|
-
_inet: 1041,
|
|
121
|
-
_timestamp: 1115,
|
|
122
|
-
_date: 1182,
|
|
123
|
-
_time: 1183,
|
|
124
|
-
_timestamptz: 1185,
|
|
125
|
-
_interval: 1187,
|
|
126
|
-
_numeric: 1231,
|
|
127
|
-
_cstring: 1263,
|
|
128
|
-
_timetz: 1270,
|
|
129
|
-
_bit: 1561,
|
|
130
|
-
_varbit: 1563,
|
|
131
|
-
_uuid: 2951,
|
|
132
|
-
_jsonb: 3807,
|
|
133
|
-
};
|
|
134
|
-
exports.DataTypeNames = {
|
|
135
|
-
[exports.DataTypeOIDs.bool]: 'bool',
|
|
136
|
-
[exports.DataTypeOIDs.bytea]: 'bytea',
|
|
137
|
-
[exports.DataTypeOIDs.char]: 'char',
|
|
138
|
-
[exports.DataTypeOIDs.name]: 'name',
|
|
139
|
-
[exports.DataTypeOIDs.int8]: 'int8',
|
|
140
|
-
[exports.DataTypeOIDs.int2]: 'int2',
|
|
141
|
-
[exports.DataTypeOIDs.int2vector]: 'int2vector',
|
|
142
|
-
[exports.DataTypeOIDs.int4]: 'int4',
|
|
143
|
-
[exports.DataTypeOIDs.regproc]: 'regproc',
|
|
144
|
-
[exports.DataTypeOIDs.text]: 'text',
|
|
145
|
-
[exports.DataTypeOIDs.oid]: 'oid',
|
|
146
|
-
[exports.DataTypeOIDs.tid]: 'tid',
|
|
147
|
-
[exports.DataTypeOIDs.xid]: 'xid',
|
|
148
|
-
[exports.DataTypeOIDs.cid]: 'cid',
|
|
149
|
-
[exports.DataTypeOIDs.oidvector]: 'oidvector',
|
|
150
|
-
[exports.DataTypeOIDs.json]: 'json',
|
|
151
|
-
[exports.DataTypeOIDs.xml]: 'xml',
|
|
152
|
-
[exports.DataTypeOIDs.point]: 'point',
|
|
153
|
-
[exports.DataTypeOIDs.lseg]: 'lseg',
|
|
154
|
-
[exports.DataTypeOIDs.path]: 'path',
|
|
155
|
-
[exports.DataTypeOIDs.box]: 'box',
|
|
156
|
-
[exports.DataTypeOIDs.polygon]: 'polygon',
|
|
157
|
-
[exports.DataTypeOIDs.line]: 'line',
|
|
158
|
-
[exports.DataTypeOIDs.cidr]: 'cidr',
|
|
159
|
-
[exports.DataTypeOIDs.float4]: 'float4',
|
|
160
|
-
[exports.DataTypeOIDs.float8]: 'float8',
|
|
161
|
-
[exports.DataTypeOIDs.unknown]: 'unknown',
|
|
162
|
-
[exports.DataTypeOIDs.circle]: 'circle',
|
|
163
|
-
[exports.DataTypeOIDs.macaddr8]: 'macaddr8',
|
|
164
|
-
[exports.DataTypeOIDs.money]: 'money',
|
|
165
|
-
[exports.DataTypeOIDs.macaddr]: 'macaddr',
|
|
166
|
-
[exports.DataTypeOIDs.inet]: 'inet',
|
|
167
|
-
[exports.DataTypeOIDs.bpchar]: 'bpchar',
|
|
168
|
-
[exports.DataTypeOIDs.varchar]: 'varchar',
|
|
169
|
-
[exports.DataTypeOIDs.date]: 'date',
|
|
170
|
-
[exports.DataTypeOIDs.time]: 'time',
|
|
171
|
-
[exports.DataTypeOIDs.timestamp]: 'timestamp',
|
|
172
|
-
[exports.DataTypeOIDs.timestamptz]: 'timestamptz',
|
|
173
|
-
[exports.DataTypeOIDs.interval]: 'interval',
|
|
174
|
-
[exports.DataTypeOIDs.timetz]: 'timetz',
|
|
175
|
-
[exports.DataTypeOIDs.bit]: 'bit',
|
|
176
|
-
[exports.DataTypeOIDs.varbit]: 'varbit',
|
|
177
|
-
[exports.DataTypeOIDs.numeric]: 'numeric',
|
|
178
|
-
[exports.DataTypeOIDs.refcursor]: 'refcursor',
|
|
179
|
-
[exports.DataTypeOIDs.regprocedure]: 'regprocedure',
|
|
180
|
-
[exports.DataTypeOIDs.regoper]: 'regoper',
|
|
181
|
-
[exports.DataTypeOIDs.regoperator]: 'regoperator',
|
|
182
|
-
[exports.DataTypeOIDs.regclass]: 'regclass',
|
|
183
|
-
[exports.DataTypeOIDs.regtype]: 'regtype',
|
|
184
|
-
[exports.DataTypeOIDs.record]: 'record',
|
|
185
|
-
[exports.DataTypeOIDs.cstring]: 'cstring',
|
|
186
|
-
[exports.DataTypeOIDs.any]: 'any',
|
|
187
|
-
[exports.DataTypeOIDs.anyarray]: 'anyarray',
|
|
188
|
-
[exports.DataTypeOIDs.void]: 'void',
|
|
189
|
-
[exports.DataTypeOIDs.trigger]: 'trigger',
|
|
190
|
-
[exports.DataTypeOIDs.language_handler]: 'language_handler',
|
|
191
|
-
[exports.DataTypeOIDs.internal]: 'internal',
|
|
192
|
-
[exports.DataTypeOIDs.anyelement]: 'anyelement',
|
|
193
|
-
[exports.DataTypeOIDs.anynonarray]: 'anynonarray',
|
|
194
|
-
[exports.DataTypeOIDs.uuid]: 'uuid',
|
|
195
|
-
[exports.DataTypeOIDs.jsonb]: 'jsonb',
|
|
196
|
-
[exports.DataTypeOIDs.anyrange]: 'anyrange',
|
|
197
|
-
[exports.DataTypeOIDs.int4range]: 'int4range',
|
|
198
|
-
[exports.DataTypeOIDs.numrange]: 'numrange',
|
|
199
|
-
[exports.DataTypeOIDs.tsrange]: 'tsrange',
|
|
200
|
-
[exports.DataTypeOIDs.rstzrange]: 'rstzrange',
|
|
201
|
-
[exports.DataTypeOIDs.daterange]: 'daterange',
|
|
202
|
-
[exports.DataTypeOIDs.int8range]: 'int8range',
|
|
203
|
-
[exports.DataTypeOIDs._xml]: '_xml',
|
|
204
|
-
[exports.DataTypeOIDs._json]: '_json',
|
|
205
|
-
[exports.DataTypeOIDs._xid8]: '_xid8',
|
|
206
|
-
[exports.DataTypeOIDs._line]: '_line',
|
|
207
|
-
[exports.DataTypeOIDs._cidr]: '_cidr',
|
|
208
|
-
[exports.DataTypeOIDs._circle]: '_circle',
|
|
209
|
-
[exports.DataTypeOIDs._macaddr8]: '_macaddr8',
|
|
210
|
-
[exports.DataTypeOIDs._money]: '_money',
|
|
211
|
-
[exports.DataTypeOIDs._bool]: '_bool',
|
|
212
|
-
[exports.DataTypeOIDs._bytea]: '_bytea',
|
|
213
|
-
[exports.DataTypeOIDs._char]: '_char',
|
|
214
|
-
[exports.DataTypeOIDs._name]: '_name',
|
|
215
|
-
[exports.DataTypeOIDs._int2]: '_int2',
|
|
216
|
-
[exports.DataTypeOIDs._int2vector]: '_int2vector',
|
|
217
|
-
[exports.DataTypeOIDs._int4]: '_int4',
|
|
218
|
-
[exports.DataTypeOIDs._regproc]: '_regproc',
|
|
219
|
-
[exports.DataTypeOIDs._text]: '_text',
|
|
220
|
-
[exports.DataTypeOIDs._tid]: '_tid',
|
|
221
|
-
[exports.DataTypeOIDs._xid]: '_xid',
|
|
222
|
-
[exports.DataTypeOIDs._cid]: '_cid',
|
|
223
|
-
[exports.DataTypeOIDs._oidvector]: '_oidvector',
|
|
224
|
-
[exports.DataTypeOIDs._bpchar]: '_bpchar',
|
|
225
|
-
[exports.DataTypeOIDs._varchar]: '_varchar',
|
|
226
|
-
[exports.DataTypeOIDs._int8]: '_int8',
|
|
227
|
-
[exports.DataTypeOIDs._point]: '_point',
|
|
228
|
-
[exports.DataTypeOIDs._lseg]: '_lseg',
|
|
229
|
-
[exports.DataTypeOIDs._path]: '_path',
|
|
230
|
-
[exports.DataTypeOIDs._box]: '_box',
|
|
231
|
-
[exports.DataTypeOIDs._float4]: '_float4',
|
|
232
|
-
[exports.DataTypeOIDs._float8]: '_float8',
|
|
233
|
-
[exports.DataTypeOIDs._polygon]: '_polygon',
|
|
234
|
-
[exports.DataTypeOIDs._oid]: '_oid',
|
|
235
|
-
[exports.DataTypeOIDs._macaddr]: '_macaddr',
|
|
236
|
-
[exports.DataTypeOIDs._inet]: '_inet',
|
|
237
|
-
[exports.DataTypeOIDs._timestamp]: '_timestamp',
|
|
238
|
-
[exports.DataTypeOIDs._date]: '_date',
|
|
239
|
-
[exports.DataTypeOIDs._time]: '_time',
|
|
240
|
-
[exports.DataTypeOIDs._timestamptz]: '_timestamptz',
|
|
241
|
-
[exports.DataTypeOIDs._interval]: '_interval',
|
|
242
|
-
[exports.DataTypeOIDs._numeric]: '_numeric',
|
|
243
|
-
[exports.DataTypeOIDs._cstring]: '_cstring',
|
|
244
|
-
[exports.DataTypeOIDs._timetz]: '_timetz',
|
|
245
|
-
[exports.DataTypeOIDs._bit]: '_bit',
|
|
246
|
-
[exports.DataTypeOIDs._varbit]: '_varbit',
|
|
247
|
-
[exports.DataTypeOIDs._uuid]: '_uuid',
|
|
248
|
-
[exports.DataTypeOIDs._jsonb]: '_jsonb',
|
|
249
|
-
};
|
package/cjs/data-type-map.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GlobalTypeMap = exports.DataTypeMap = void 0;
|
|
4
|
-
const constants_js_1 = require("./constants.js");
|
|
5
|
-
const bool_type_js_1 = require("./data-types/bool-type.js");
|
|
6
|
-
const box_type_js_1 = require("./data-types/box-type.js");
|
|
7
|
-
const bytea_type_js_1 = require("./data-types/bytea-type.js");
|
|
8
|
-
const char_type_js_1 = require("./data-types/char-type.js");
|
|
9
|
-
const circle_type_js_1 = require("./data-types/circle-type.js");
|
|
10
|
-
const date_type_js_1 = require("./data-types/date-type.js");
|
|
11
|
-
const float4_type_js_1 = require("./data-types/float4-type.js");
|
|
12
|
-
const float8_type_js_1 = require("./data-types/float8-type.js");
|
|
13
|
-
const int2_type_js_1 = require("./data-types/int2-type.js");
|
|
14
|
-
const int2_vector_type_js_1 = require("./data-types/int2-vector-type.js");
|
|
15
|
-
const int4_type_js_1 = require("./data-types/int4-type.js");
|
|
16
|
-
const int8_type_js_1 = require("./data-types/int8-type.js");
|
|
17
|
-
const json_type_js_1 = require("./data-types/json-type.js");
|
|
18
|
-
const jsonb_type_js_1 = require("./data-types/jsonb-type.js");
|
|
19
|
-
const lseg_type_js_1 = require("./data-types/lseg-type.js");
|
|
20
|
-
const numeric_type_js_1 = require("./data-types/numeric-type.js");
|
|
21
|
-
const oid_type_js_1 = require("./data-types/oid-type.js");
|
|
22
|
-
const point_type_js_1 = require("./data-types/point-type.js");
|
|
23
|
-
const time_type_js_1 = require("./data-types/time-type.js");
|
|
24
|
-
const timestamp_type_js_1 = require("./data-types/timestamp-type.js");
|
|
25
|
-
const timestamptz_type_js_1 = require("./data-types/timestamptz-type.js");
|
|
26
|
-
const uuid_type_js_1 = require("./data-types/uuid-type.js");
|
|
27
|
-
const varchar_type_js_1 = require("./data-types/varchar-type.js");
|
|
28
|
-
class DataTypeMap {
|
|
29
|
-
constructor(other) {
|
|
30
|
-
this._itemsByOID = {};
|
|
31
|
-
this._items = [];
|
|
32
|
-
if (other instanceof DataTypeMap)
|
|
33
|
-
Object.assign(this._items, other._items);
|
|
34
|
-
}
|
|
35
|
-
get(oid) {
|
|
36
|
-
return this._itemsByOID[oid];
|
|
37
|
-
}
|
|
38
|
-
register(dataTypes) {
|
|
39
|
-
dataTypes = Array.isArray(dataTypes) ? dataTypes : [dataTypes];
|
|
40
|
-
for (const t of dataTypes) {
|
|
41
|
-
this._itemsByOID[t.oid] = t;
|
|
42
|
-
const i = this._items.findIndex(tt => tt.oid === t.oid);
|
|
43
|
-
if (i >= 0)
|
|
44
|
-
this._items[i] = t;
|
|
45
|
-
else
|
|
46
|
-
this._items.push(t);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
determine(value) {
|
|
50
|
-
if (value == null)
|
|
51
|
-
return constants_js_1.DataTypeOIDs.unknown;
|
|
52
|
-
const valueIsArray = Array.isArray(value);
|
|
53
|
-
let i;
|
|
54
|
-
let t;
|
|
55
|
-
for (i = this._items.length - 1; i >= 0; i--) {
|
|
56
|
-
t = this._items[i];
|
|
57
|
-
if (valueIsArray) {
|
|
58
|
-
if (t.elementsOID && t.isType(value[0]))
|
|
59
|
-
return t.oid;
|
|
60
|
-
}
|
|
61
|
-
else if (!t.elementsOID && t.isType(value))
|
|
62
|
-
return t.oid;
|
|
63
|
-
}
|
|
64
|
-
return constants_js_1.DataTypeOIDs.unknown;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.DataTypeMap = DataTypeMap;
|
|
68
|
-
exports.GlobalTypeMap = new DataTypeMap();
|
|
69
|
-
exports.GlobalTypeMap.register([oid_type_js_1.OidType, oid_type_js_1.VectorOidType, oid_type_js_1.ArrayOidType]);
|
|
70
|
-
exports.GlobalTypeMap.register([jsonb_type_js_1.JsonbType, jsonb_type_js_1.ArrayJsonbType]);
|
|
71
|
-
exports.GlobalTypeMap.register([json_type_js_1.JsonType, json_type_js_1.ArrayJsonType]);
|
|
72
|
-
exports.GlobalTypeMap.register([bool_type_js_1.BoolType, bool_type_js_1.ArrayBoolType]);
|
|
73
|
-
exports.GlobalTypeMap.register([numeric_type_js_1.NumericType, numeric_type_js_1.ArrayNumericType]);
|
|
74
|
-
exports.GlobalTypeMap.register([float4_type_js_1.Float4Type, float4_type_js_1.ArrayFloat4Type]);
|
|
75
|
-
exports.GlobalTypeMap.register([float8_type_js_1.Float8Type, float8_type_js_1.ArrayFloat8Type]);
|
|
76
|
-
exports.GlobalTypeMap.register([int2_type_js_1.Int2Type, int2_type_js_1.ArrayInt2Type]);
|
|
77
|
-
exports.GlobalTypeMap.register([int4_type_js_1.Int4Type, int4_type_js_1.ArrayInt4Type]);
|
|
78
|
-
exports.GlobalTypeMap.register([int8_type_js_1.Int8Type, int8_type_js_1.ArrayInt8Type]);
|
|
79
|
-
exports.GlobalTypeMap.register([bytea_type_js_1.ByteaType, bytea_type_js_1.ArrayByteaType]);
|
|
80
|
-
exports.GlobalTypeMap.register([circle_type_js_1.CircleType, circle_type_js_1.ArrayCircleType]);
|
|
81
|
-
exports.GlobalTypeMap.register([point_type_js_1.PointType, point_type_js_1.ArrayPointType]);
|
|
82
|
-
exports.GlobalTypeMap.register([lseg_type_js_1.LsegType, lseg_type_js_1.ArrayLsegType]);
|
|
83
|
-
exports.GlobalTypeMap.register([box_type_js_1.BoxType, box_type_js_1.ArrayBoxType]);
|
|
84
|
-
exports.GlobalTypeMap.register([int2_vector_type_js_1.Int2VectorType, int2_vector_type_js_1.ArrayInt2VectorType]);
|
|
85
|
-
exports.GlobalTypeMap.register({
|
|
86
|
-
...varchar_type_js_1.VarcharType,
|
|
87
|
-
name: 'bpchar',
|
|
88
|
-
oid: constants_js_1.DataTypeOIDs.bpchar,
|
|
89
|
-
});
|
|
90
|
-
exports.GlobalTypeMap.register({
|
|
91
|
-
...varchar_type_js_1.ArrayVarcharType,
|
|
92
|
-
name: '_bpchar',
|
|
93
|
-
oid: constants_js_1.DataTypeOIDs._bpchar,
|
|
94
|
-
elementsOID: constants_js_1.DataTypeOIDs.bpchar,
|
|
95
|
-
});
|
|
96
|
-
exports.GlobalTypeMap.register({
|
|
97
|
-
...varchar_type_js_1.VarcharType,
|
|
98
|
-
name: 'name',
|
|
99
|
-
oid: constants_js_1.DataTypeOIDs.name,
|
|
100
|
-
});
|
|
101
|
-
exports.GlobalTypeMap.register({
|
|
102
|
-
...varchar_type_js_1.ArrayVarcharType,
|
|
103
|
-
name: '_name',
|
|
104
|
-
oid: constants_js_1.DataTypeOIDs._name,
|
|
105
|
-
elementsOID: constants_js_1.DataTypeOIDs.name,
|
|
106
|
-
});
|
|
107
|
-
exports.GlobalTypeMap.register({
|
|
108
|
-
...varchar_type_js_1.VarcharType,
|
|
109
|
-
name: 'text',
|
|
110
|
-
oid: constants_js_1.DataTypeOIDs.text,
|
|
111
|
-
});
|
|
112
|
-
exports.GlobalTypeMap.register({
|
|
113
|
-
...varchar_type_js_1.ArrayVarcharType,
|
|
114
|
-
name: '_text',
|
|
115
|
-
oid: constants_js_1.DataTypeOIDs._text,
|
|
116
|
-
elementsOID: constants_js_1.DataTypeOIDs.text,
|
|
117
|
-
});
|
|
118
|
-
exports.GlobalTypeMap.register({ ...varchar_type_js_1.VarcharType, name: 'xml', oid: constants_js_1.DataTypeOIDs.xml });
|
|
119
|
-
exports.GlobalTypeMap.register({
|
|
120
|
-
...varchar_type_js_1.ArrayVarcharType,
|
|
121
|
-
name: '_xml',
|
|
122
|
-
oid: constants_js_1.DataTypeOIDs._xml,
|
|
123
|
-
elementsOID: constants_js_1.DataTypeOIDs.xml,
|
|
124
|
-
});
|
|
125
|
-
exports.GlobalTypeMap.register([varchar_type_js_1.VarcharType, varchar_type_js_1.ArrayVarcharType]);
|
|
126
|
-
exports.GlobalTypeMap.register([uuid_type_js_1.UuidType, uuid_type_js_1.ArrayUuidType]);
|
|
127
|
-
exports.GlobalTypeMap.register([char_type_js_1.CharType, char_type_js_1.ArrayCharType]);
|
|
128
|
-
exports.GlobalTypeMap.register([timestamptz_type_js_1.TimestamptzType, timestamptz_type_js_1.ArrayTimestamptzType]);
|
|
129
|
-
exports.GlobalTypeMap.register([time_type_js_1.TimeType, time_type_js_1.ArrayTimeType]);
|
|
130
|
-
exports.GlobalTypeMap.register([date_type_js_1.DateType, date_type_js_1.ArrayDateType]);
|
|
131
|
-
exports.GlobalTypeMap.register([timestamp_type_js_1.TimestampType, timestamp_type_js_1.ArrayTimestampType]);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayBoolType = exports.BoolType = void 0;
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
exports.BoolType = {
|
|
6
|
-
name: 'bool',
|
|
7
|
-
oid: constants_js_1.DataTypeOIDs.bool,
|
|
8
|
-
jsType: 'boolean',
|
|
9
|
-
parseBinary(v) {
|
|
10
|
-
return !!v.readUInt8();
|
|
11
|
-
},
|
|
12
|
-
encodeBinary(buf, v) {
|
|
13
|
-
buf.writeInt8(v ? 1 : 0);
|
|
14
|
-
},
|
|
15
|
-
parseText(v) {
|
|
16
|
-
return (v === 'TRUE' ||
|
|
17
|
-
v === 't' ||
|
|
18
|
-
v === 'true' ||
|
|
19
|
-
v === 'y' ||
|
|
20
|
-
v === 'yes' ||
|
|
21
|
-
v === 'on' ||
|
|
22
|
-
v === '1');
|
|
23
|
-
},
|
|
24
|
-
isType(v) {
|
|
25
|
-
return typeof v === 'boolean';
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
exports.ArrayBoolType = {
|
|
29
|
-
...exports.BoolType,
|
|
30
|
-
name: '_bool',
|
|
31
|
-
oid: constants_js_1.DataTypeOIDs._bool,
|
|
32
|
-
elementsOID: constants_js_1.DataTypeOIDs.bool,
|
|
33
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayBoxType = exports.BoxType = void 0;
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
const BOX_PATTERN1 = /^\( *\( *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *\) *, *\( *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *\) *\)$/;
|
|
6
|
-
const BOX_PATTERN2 = /^\( *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *\) *, *\( *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *\)$/;
|
|
7
|
-
const BOX_PATTERN3 = /^(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *, *(-?\d+\.?\d*)$/;
|
|
8
|
-
exports.BoxType = {
|
|
9
|
-
name: 'box',
|
|
10
|
-
oid: constants_js_1.DataTypeOIDs.box,
|
|
11
|
-
jsType: 'object',
|
|
12
|
-
arraySeparator: ';',
|
|
13
|
-
parseBinary(v) {
|
|
14
|
-
return {
|
|
15
|
-
x1: v.readDoubleBE(0),
|
|
16
|
-
y1: v.readDoubleBE(8),
|
|
17
|
-
x2: v.readDoubleBE(16),
|
|
18
|
-
y2: v.readDoubleBE(24),
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
encodeBinary(buf, v) {
|
|
22
|
-
buf.writeDoubleBE(v.x1);
|
|
23
|
-
buf.writeDoubleBE(v.y1);
|
|
24
|
-
buf.writeDoubleBE(v.x2);
|
|
25
|
-
buf.writeDoubleBE(v.y2);
|
|
26
|
-
},
|
|
27
|
-
parseText(v) {
|
|
28
|
-
const m = v.match(BOX_PATTERN1) || v.match(BOX_PATTERN2) || v.match(BOX_PATTERN3);
|
|
29
|
-
if (!m)
|
|
30
|
-
return undefined;
|
|
31
|
-
return {
|
|
32
|
-
x1: parseFloat(m[1]),
|
|
33
|
-
y1: parseFloat(m[2]),
|
|
34
|
-
x2: parseFloat(m[3]),
|
|
35
|
-
y2: parseFloat(m[4]),
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
isType(v) {
|
|
39
|
-
return (typeof v === 'object' &&
|
|
40
|
-
Object.keys(v).length === 4 &&
|
|
41
|
-
typeof v.x1 === 'number' &&
|
|
42
|
-
typeof v.y1 === 'number' &&
|
|
43
|
-
typeof v.x2 === 'number' &&
|
|
44
|
-
typeof v.y2 === 'number');
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
exports.ArrayBoxType = {
|
|
48
|
-
...exports.BoxType,
|
|
49
|
-
name: '_box',
|
|
50
|
-
oid: constants_js_1.DataTypeOIDs._box,
|
|
51
|
-
elementsOID: constants_js_1.DataTypeOIDs.box,
|
|
52
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayByteaType = exports.ByteaType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// @ts-ignore -- no type definitions for decodeBytea
|
|
6
|
-
const postgres_bytea_1 = tslib_1.__importDefault(require("postgres-bytea"));
|
|
7
|
-
const constants_js_1 = require("../constants.js");
|
|
8
|
-
exports.ByteaType = {
|
|
9
|
-
name: 'bytea',
|
|
10
|
-
oid: constants_js_1.DataTypeOIDs.bytea,
|
|
11
|
-
jsType: 'Buffer',
|
|
12
|
-
parseBinary(v) {
|
|
13
|
-
return v;
|
|
14
|
-
},
|
|
15
|
-
encodeBinary(buf, v) {
|
|
16
|
-
buf.writeBuffer(v);
|
|
17
|
-
},
|
|
18
|
-
parseText: postgres_bytea_1.default,
|
|
19
|
-
isType(v) {
|
|
20
|
-
return v instanceof Buffer;
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
exports.ArrayByteaType = {
|
|
24
|
-
...exports.ByteaType,
|
|
25
|
-
name: '_bytea',
|
|
26
|
-
oid: constants_js_1.DataTypeOIDs._bytea,
|
|
27
|
-
elementsOID: constants_js_1.DataTypeOIDs.bytea,
|
|
28
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayCharType = exports.CharType = void 0;
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
exports.CharType = {
|
|
6
|
-
name: 'char',
|
|
7
|
-
oid: constants_js_1.DataTypeOIDs.char,
|
|
8
|
-
jsType: 'string',
|
|
9
|
-
parseBinary(v) {
|
|
10
|
-
return v.toString('utf8');
|
|
11
|
-
},
|
|
12
|
-
encodeBinary(buf, v) {
|
|
13
|
-
buf.writeString((v ? '' + v : ' ')[0], 'utf8');
|
|
14
|
-
},
|
|
15
|
-
parseText(v) {
|
|
16
|
-
return '' + v;
|
|
17
|
-
},
|
|
18
|
-
isType(v) {
|
|
19
|
-
return typeof v === 'string' && v.length === 1;
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
exports.ArrayCharType = {
|
|
23
|
-
...exports.CharType,
|
|
24
|
-
name: '_char',
|
|
25
|
-
oid: constants_js_1.DataTypeOIDs._char,
|
|
26
|
-
elementsOID: constants_js_1.DataTypeOIDs.char,
|
|
27
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayCircleType = exports.CircleType = void 0;
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
const CIRCLE_PATTERN1 = /^< *\( *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *\) *, *(-?\d+\.?\d*) *>$/;
|
|
6
|
-
const CIRCLE_PATTERN2 = /^\( *\( *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *\) *, *(-?\d+\.?\d*) *\)$/;
|
|
7
|
-
const CIRCLE_PATTERN3 = /^\( *(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *\) *, *(-?\d+\.?\d*)$/;
|
|
8
|
-
const CIRCLE_PATTERN4 = /^(-?\d+\.?\d*) *, *(-?\d+\.?\d*) *, *(-?\d+\.?\d*)$/;
|
|
9
|
-
exports.CircleType = {
|
|
10
|
-
name: 'circle',
|
|
11
|
-
oid: constants_js_1.DataTypeOIDs.circle,
|
|
12
|
-
jsType: 'object',
|
|
13
|
-
parseBinary(v) {
|
|
14
|
-
return {
|
|
15
|
-
x: v.readDoubleBE(0),
|
|
16
|
-
y: v.readDoubleBE(8),
|
|
17
|
-
r: v.readDoubleBE(16),
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
encodeBinary(buf, v) {
|
|
21
|
-
buf.writeDoubleBE(v.x);
|
|
22
|
-
buf.writeDoubleBE(v.y);
|
|
23
|
-
buf.writeDoubleBE(v.r);
|
|
24
|
-
},
|
|
25
|
-
parseText(v) {
|
|
26
|
-
const m = v.match(CIRCLE_PATTERN1) ||
|
|
27
|
-
v.match(CIRCLE_PATTERN2) ||
|
|
28
|
-
v.match(CIRCLE_PATTERN3) ||
|
|
29
|
-
v.match(CIRCLE_PATTERN4);
|
|
30
|
-
if (!m)
|
|
31
|
-
return undefined;
|
|
32
|
-
return {
|
|
33
|
-
x: parseFloat(m[1]),
|
|
34
|
-
y: parseFloat(m[2]),
|
|
35
|
-
r: parseFloat(m[3]),
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
isType(v) {
|
|
39
|
-
return (typeof v === 'object' &&
|
|
40
|
-
Object.keys(v).length === 3 &&
|
|
41
|
-
typeof v.x === 'number' &&
|
|
42
|
-
typeof v.y === 'number' &&
|
|
43
|
-
typeof v.r === 'number');
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
exports.ArrayCircleType = {
|
|
47
|
-
...exports.CircleType,
|
|
48
|
-
name: '_circle',
|
|
49
|
-
oid: constants_js_1.DataTypeOIDs._circle,
|
|
50
|
-
elementsOID: constants_js_1.DataTypeOIDs.circle,
|
|
51
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayDateType = exports.DateType = void 0;
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
const parse_datetime_js_1 = require("../util/parse-datetime.js");
|
|
6
|
-
const timeShift = 946684800000;
|
|
7
|
-
exports.DateType = {
|
|
8
|
-
name: 'date',
|
|
9
|
-
oid: constants_js_1.DataTypeOIDs.date,
|
|
10
|
-
jsType: 'Date',
|
|
11
|
-
parseBinary(v, options) {
|
|
12
|
-
const fetchAsString = options.fetchAsString &&
|
|
13
|
-
options.fetchAsString.includes(constants_js_1.DataTypeOIDs.date);
|
|
14
|
-
const t = v.readInt32BE();
|
|
15
|
-
if (t === 0x7fffffff)
|
|
16
|
-
return fetchAsString ? 'infinity' : Infinity;
|
|
17
|
-
if (t === -0x80000000)
|
|
18
|
-
return fetchAsString ? '-infinity' : -Infinity;
|
|
19
|
-
// Shift from 2000 to 1970
|
|
20
|
-
let d = new Date(t * 1000 * 86400 + timeShift);
|
|
21
|
-
if (fetchAsString || !options.utcDates)
|
|
22
|
-
d = new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
23
|
-
return fetchAsString ? dateToDateString(d) : d;
|
|
24
|
-
},
|
|
25
|
-
encodeBinary(buf, v, options) {
|
|
26
|
-
if (typeof v === 'string')
|
|
27
|
-
v = (0, parse_datetime_js_1.parseDateTime)(v, false, false, options.utcDates);
|
|
28
|
-
if (v === Infinity) {
|
|
29
|
-
buf.writeInt32BE(0x7fffffff);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (v === -Infinity) {
|
|
33
|
-
buf.writeInt32BE(-0x80000000);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (!(v instanceof Date))
|
|
37
|
-
v = new Date(v);
|
|
38
|
-
let n = options.utcDates
|
|
39
|
-
? v.getTime()
|
|
40
|
-
: v.getTime() - v.getTimezoneOffset() * 60 * 1000;
|
|
41
|
-
n = (n - timeShift) / 1000 / 86400;
|
|
42
|
-
const t = Math.trunc(n + Number.EPSILON);
|
|
43
|
-
buf.writeInt32BE(t);
|
|
44
|
-
},
|
|
45
|
-
parseText(v, options) {
|
|
46
|
-
const fetchAsString = options.fetchAsString &&
|
|
47
|
-
options.fetchAsString.includes(constants_js_1.DataTypeOIDs.date);
|
|
48
|
-
if (fetchAsString)
|
|
49
|
-
return v;
|
|
50
|
-
return (0, parse_datetime_js_1.parseDateTime)(v, false, false, options.utcDates);
|
|
51
|
-
},
|
|
52
|
-
isType(v) {
|
|
53
|
-
return (v instanceof Date &&
|
|
54
|
-
v.getHours() === 0 &&
|
|
55
|
-
v.getMinutes() === 0 &&
|
|
56
|
-
v.getSeconds() === 0 &&
|
|
57
|
-
v.getMilliseconds() === 0);
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
function padZero(v) {
|
|
61
|
-
return v < 9 ? '0' + v : '' + v;
|
|
62
|
-
}
|
|
63
|
-
function dateToDateString(d) {
|
|
64
|
-
return (d.getFullYear() +
|
|
65
|
-
'-' +
|
|
66
|
-
padZero(d.getMonth() + 1) +
|
|
67
|
-
'-' +
|
|
68
|
-
padZero(d.getDate()));
|
|
69
|
-
}
|
|
70
|
-
exports.ArrayDateType = {
|
|
71
|
-
...exports.DateType,
|
|
72
|
-
name: '_date',
|
|
73
|
-
oid: constants_js_1.DataTypeOIDs._date,
|
|
74
|
-
elementsOID: constants_js_1.DataTypeOIDs.date,
|
|
75
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayFloat4Type = exports.Float4Type = void 0;
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
exports.Float4Type = {
|
|
6
|
-
name: 'float4',
|
|
7
|
-
oid: constants_js_1.DataTypeOIDs.float4,
|
|
8
|
-
jsType: 'number',
|
|
9
|
-
parseBinary(v) {
|
|
10
|
-
return Math.round((v.readFloatBE(0) + Number.EPSILON) * 100) / 100;
|
|
11
|
-
},
|
|
12
|
-
encodeBinary(buf, v) {
|
|
13
|
-
buf.writeFloatBE(typeof v === 'number' ? v : parseFloat(v));
|
|
14
|
-
},
|
|
15
|
-
parseText: parseFloat,
|
|
16
|
-
isType(v) {
|
|
17
|
-
return typeof v === 'number';
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
exports.ArrayFloat4Type = {
|
|
21
|
-
...exports.Float4Type,
|
|
22
|
-
name: '_float4',
|
|
23
|
-
oid: constants_js_1.DataTypeOIDs._float4,
|
|
24
|
-
elementsOID: constants_js_1.DataTypeOIDs.float4,
|
|
25
|
-
};
|