postgrejs 2.15.4 → 2.16.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 +7 -0
- package/esm/connection/bind-param.js +5 -1
- package/esm/connection/connection.js +20 -16
- package/esm/connection/cursor.js +15 -10
- package/esm/connection/intl-connection.js +46 -41
- package/esm/connection/pool.js +32 -28
- package/esm/connection/portal.js +31 -27
- package/esm/connection/prepared-statement.js +35 -31
- package/esm/constants.js +125 -122
- package/esm/data-type-map.js +75 -71
- package/esm/data-types/bool-type.js +10 -7
- package/esm/data-types/box-type.js +10 -7
- package/esm/data-types/bytea-type.js +13 -9
- package/esm/data-types/char-type.js +10 -7
- package/esm/data-types/circle-type.js +10 -7
- package/esm/data-types/date-type.js +15 -12
- package/esm/data-types/float4-type.js +10 -7
- package/esm/data-types/float8-type.js +10 -7
- package/esm/data-types/int2-type.js +13 -10
- package/esm/data-types/int2-vector-type.js +16 -13
- package/esm/data-types/int4-type.js +13 -10
- package/esm/data-types/int8-type.js +12 -9
- package/esm/data-types/json-type.js +12 -9
- package/esm/data-types/jsonb-type.js +14 -11
- package/esm/data-types/lseg-type.js +10 -7
- package/esm/data-types/numeric-type.js +12 -8
- package/esm/data-types/oid-type.js +18 -15
- package/esm/data-types/point-type.js +10 -7
- package/esm/data-types/time-type.js +16 -13
- package/esm/data-types/timestamp-type.js +15 -12
- package/esm/data-types/timestamptz-type.js +15 -12
- package/esm/data-types/uuid-type.js +10 -7
- package/esm/data-types/varchar-type.js +10 -7
- package/esm/index.js +28 -25
- package/esm/interfaces/command-result.js +2 -1
- package/esm/interfaces/data-mapping-options.js +2 -1
- package/esm/interfaces/data-type.js +2 -1
- package/esm/interfaces/database-connection-params.js +2 -1
- package/esm/interfaces/field-info.js +2 -1
- package/esm/interfaces/query-options.js +2 -1
- package/esm/interfaces/query-result.js +2 -1
- package/esm/interfaces/script-execute-options.js +2 -1
- package/esm/interfaces/script-result.js +2 -1
- package/esm/interfaces/statement-prepare-options.js +2 -1
- package/esm/protocol/backend.js +28 -24
- package/esm/protocol/buffer-reader.js +5 -1
- package/esm/protocol/database-error.js +5 -1
- package/esm/protocol/frontend.js +31 -27
- package/esm/protocol/pg-socket.js +53 -48
- package/esm/protocol/protocol.js +5 -2
- package/esm/protocol/sasl.js +11 -7
- package/esm/protocol/smart-buffer.js +10 -5
- package/esm/safe-event-emitter.js +6 -2
- package/esm/types.js +2 -1
- package/esm/util/array-calculatedim.js +4 -1
- package/esm/util/bigint-methods.js +6 -2
- package/esm/util/config-from-env.js +8 -5
- package/esm/util/connection-config.js +13 -8
- package/esm/util/convert-row-to-object.js +4 -1
- package/esm/util/decode-binaryarray.js +6 -3
- package/esm/util/encode-binaryarray.js +8 -5
- package/esm/util/escape-literal.js +4 -1
- package/esm/util/fast-parseint.js +4 -1
- package/esm/util/get-parsers.js +11 -8
- package/esm/util/parse-array.js +4 -1
- package/esm/util/parse-datetime.js +8 -5
- package/esm/util/parse-row.js +4 -1
- package/esm/util/parse-time.js +12 -8
- package/esm/util/stringify-arrayliteral.js +6 -3
- package/esm/util/stringify-for-sql.js +12 -8
- package/esm/util/wrap-row-description.js +9 -6
- package/package.json +23 -17
- package/cjs/package.json +0 -3
- /package/{typings → types}/connection/bind-param.d.ts +0 -0
- /package/{typings → types}/connection/connection.d.ts +0 -0
- /package/{typings → types}/connection/cursor.d.ts +0 -0
- /package/{typings → types}/connection/intl-connection.d.ts +0 -0
- /package/{typings → types}/connection/pool.d.ts +0 -0
- /package/{typings → types}/connection/portal.d.ts +0 -0
- /package/{typings → types}/connection/prepared-statement.d.ts +0 -0
- /package/{typings → types}/constants.d.ts +0 -0
- /package/{typings → types}/data-type-map.d.ts +0 -0
- /package/{typings → types}/data-types/bool-type.d.ts +0 -0
- /package/{typings → types}/data-types/box-type.d.ts +0 -0
- /package/{typings → types}/data-types/bytea-type.d.ts +0 -0
- /package/{typings → types}/data-types/char-type.d.ts +0 -0
- /package/{typings → types}/data-types/circle-type.d.ts +0 -0
- /package/{typings → types}/data-types/date-type.d.ts +0 -0
- /package/{typings → types}/data-types/float4-type.d.ts +0 -0
- /package/{typings → types}/data-types/float8-type.d.ts +0 -0
- /package/{typings → types}/data-types/int2-type.d.ts +0 -0
- /package/{typings → types}/data-types/int2-vector-type.d.ts +0 -0
- /package/{typings → types}/data-types/int4-type.d.ts +0 -0
- /package/{typings → types}/data-types/int8-type.d.ts +0 -0
- /package/{typings → types}/data-types/json-type.d.ts +0 -0
- /package/{typings → types}/data-types/jsonb-type.d.ts +0 -0
- /package/{typings → types}/data-types/lseg-type.d.ts +0 -0
- /package/{typings → types}/data-types/numeric-type.d.ts +0 -0
- /package/{typings → types}/data-types/oid-type.d.ts +0 -0
- /package/{typings → types}/data-types/point-type.d.ts +0 -0
- /package/{typings → types}/data-types/time-type.d.ts +0 -0
- /package/{typings → types}/data-types/timestamp-type.d.ts +0 -0
- /package/{typings → types}/data-types/timestamptz-type.d.ts +0 -0
- /package/{typings → types}/data-types/uuid-type.d.ts +0 -0
- /package/{typings → types}/data-types/varchar-type.d.ts +0 -0
- /package/{typings → types}/index.d.ts +0 -0
- /package/{typings → types}/interfaces/command-result.d.ts +0 -0
- /package/{typings → types}/interfaces/data-mapping-options.d.ts +0 -0
- /package/{typings → types}/interfaces/data-type.d.ts +0 -0
- /package/{typings → types}/interfaces/database-connection-params.d.ts +0 -0
- /package/{typings → types}/interfaces/field-info.d.ts +0 -0
- /package/{typings → types}/interfaces/query-options.d.ts +0 -0
- /package/{typings → types}/interfaces/query-result.d.ts +0 -0
- /package/{typings → types}/interfaces/script-execute-options.d.ts +0 -0
- /package/{typings → types}/interfaces/script-result.d.ts +0 -0
- /package/{typings → types}/interfaces/statement-prepare-options.d.ts +0 -0
- /package/{typings → types}/protocol/backend.d.ts +0 -0
- /package/{typings → types}/protocol/buffer-reader.d.ts +0 -0
- /package/{typings → types}/protocol/database-error.d.ts +0 -0
- /package/{typings → types}/protocol/frontend.d.ts +0 -0
- /package/{typings → types}/protocol/pg-socket.d.ts +0 -0
- /package/{typings → types}/protocol/protocol.d.ts +0 -0
- /package/{typings → types}/protocol/sasl.d.ts +0 -0
- /package/{typings → types}/protocol/smart-buffer.d.ts +0 -0
- /package/{typings → types}/safe-event-emitter.d.ts +0 -0
- /package/{typings → types}/types.d.ts +0 -0
- /package/{typings → types}/util/array-calculatedim.d.ts +0 -0
- /package/{typings → types}/util/bigint-methods.d.ts +0 -0
- /package/{typings → types}/util/config-from-env.d.ts +0 -0
- /package/{typings → types}/util/connection-config.d.ts +0 -0
- /package/{typings → types}/util/convert-row-to-object.d.ts +0 -0
- /package/{typings → types}/util/decode-binaryarray.d.ts +0 -0
- /package/{typings → types}/util/encode-binaryarray.d.ts +0 -0
- /package/{typings → types}/util/escape-literal.d.ts +0 -0
- /package/{typings → types}/util/fast-parseint.d.ts +0 -0
- /package/{typings → types}/util/get-parsers.d.ts +0 -0
- /package/{typings → types}/util/parse-array.d.ts +0 -0
- /package/{typings → types}/util/parse-datetime.d.ts +0 -0
- /package/{typings → types}/util/parse-row.d.ts +0 -0
- /package/{typings → types}/util/parse-time.d.ts +0 -0
- /package/{typings → types}/util/stringify-arrayliteral.d.ts +0 -0
- /package/{typings → types}/util/stringify-for-sql.d.ts +0 -0
- /package/{typings → types}/util/wrap-row-description.d.ts +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreparedStatement = void 0;
|
|
4
|
+
const putil_varhelpers_1 = require("putil-varhelpers");
|
|
5
|
+
const constants_js_1 = require("../constants.js");
|
|
6
|
+
const data_type_map_js_1 = require("../data-type-map.js");
|
|
7
|
+
const protocol_js_1 = require("../protocol/protocol.js");
|
|
8
|
+
const safe_event_emitter_js_1 = require("../safe-event-emitter.js");
|
|
9
|
+
const convert_row_to_object_js_1 = require("../util/convert-row-to-object.js");
|
|
10
|
+
const get_parsers_js_1 = require("../util/get-parsers.js");
|
|
11
|
+
const parse_row_js_1 = require("../util/parse-row.js");
|
|
12
|
+
const wrap_row_description_js_1 = require("../util/wrap-row-description.js");
|
|
13
|
+
const cursor_js_1 = require("./cursor.js");
|
|
14
|
+
const intl_connection_js_1 = require("./intl-connection.js");
|
|
15
|
+
const portal_js_1 = require("./portal.js");
|
|
13
16
|
let statementCounter = 0;
|
|
14
17
|
let portalCounter = 0;
|
|
15
|
-
|
|
18
|
+
class PreparedStatement extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
16
19
|
constructor(connection, sql, paramTypes) {
|
|
17
20
|
super();
|
|
18
21
|
this._sql = '';
|
|
@@ -25,7 +28,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
25
28
|
this._onErrorSavePoint = 'SP_' + Math.round(Math.random() * 100000000);
|
|
26
29
|
}
|
|
27
30
|
static async prepare(connection, sql, options) {
|
|
28
|
-
const intoCon = getIntlConnection(connection);
|
|
31
|
+
const intoCon = (0, intl_connection_js_1.getIntlConnection)(connection);
|
|
29
32
|
intoCon.assertConnected();
|
|
30
33
|
const socket = intoCon.socket;
|
|
31
34
|
const statement = new PreparedStatement(connection, sql, options?.paramTypes);
|
|
@@ -41,7 +44,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
41
44
|
socket.sendFlushMessage();
|
|
42
45
|
try {
|
|
43
46
|
await socket.capture(async (code, msg, done) => {
|
|
44
|
-
if (code === Protocol.BackendMessageCode.ParseComplete)
|
|
47
|
+
if (code === protocol_js_1.Protocol.BackendMessageCode.ParseComplete)
|
|
45
48
|
done();
|
|
46
49
|
// May be Protocol.BackendMessageCode.NoticeResponse
|
|
47
50
|
});
|
|
@@ -49,7 +52,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
49
52
|
finally {
|
|
50
53
|
socket.sendSyncMessage();
|
|
51
54
|
await socket.capture(async (code, msg, done) => {
|
|
52
|
-
if (code === Protocol.BackendMessageCode.ReadyForQuery)
|
|
55
|
+
if (code === protocol_js_1.Protocol.BackendMessageCode.ReadyForQuery)
|
|
53
56
|
done();
|
|
54
57
|
// May be Protocol.BackendMessageCode.NoticeResponse
|
|
55
58
|
});
|
|
@@ -76,7 +79,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
76
79
|
return this._paramTypes;
|
|
77
80
|
}
|
|
78
81
|
async execute(options = {}) {
|
|
79
|
-
const intlCon = getIntlConnection(this.connection);
|
|
82
|
+
const intlCon = (0, intl_connection_js_1.getIntlConnection)(this.connection);
|
|
80
83
|
const transactionCommand = this.sql.match(/^(\bBEGIN\b|\bCOMMIT\b|\bSTART\b|\bROLLBACK|SAVEPOINT|RELEASE\b)/i);
|
|
81
84
|
let beginFirst = false;
|
|
82
85
|
let commitLast = false;
|
|
@@ -93,7 +96,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
93
96
|
const rollbackOnError = !transactionCommand &&
|
|
94
97
|
(options?.rollbackOnError != null
|
|
95
98
|
? options.rollbackOnError
|
|
96
|
-
: coerceToBoolean(intlCon.config.rollbackOnError, true));
|
|
99
|
+
: (0, putil_varhelpers_1.coerceToBoolean)(intlCon.config.rollbackOnError, true));
|
|
97
100
|
if (intlCon.inTransaction && rollbackOnError)
|
|
98
101
|
await intlCon.execute('SAVEPOINT ' + this._onErrorSavePoint);
|
|
99
102
|
try {
|
|
@@ -116,7 +119,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
116
119
|
--this._refCount;
|
|
117
120
|
if (this._refCount > 0)
|
|
118
121
|
return;
|
|
119
|
-
const intoCon = getIntlConnection(this.connection);
|
|
122
|
+
const intoCon = (0, intl_connection_js_1.getIntlConnection)(this.connection);
|
|
120
123
|
await intoCon.statementQueue.enqueue(() => this._close()).toPromise();
|
|
121
124
|
}
|
|
122
125
|
async cancel() {
|
|
@@ -124,7 +127,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
124
127
|
}
|
|
125
128
|
async _execute(options = {}) {
|
|
126
129
|
let portal;
|
|
127
|
-
const intlCon = getIntlConnection(this.connection);
|
|
130
|
+
const intlCon = (0, intl_connection_js_1.getIntlConnection)(this.connection);
|
|
128
131
|
intlCon.ref();
|
|
129
132
|
try {
|
|
130
133
|
const result = { command: undefined };
|
|
@@ -132,19 +135,19 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
132
135
|
const t = Date.now();
|
|
133
136
|
// Create portal
|
|
134
137
|
const portalName = 'P_' + ++portalCounter;
|
|
135
|
-
portal = new Portal(this, portalName);
|
|
138
|
+
portal = new portal_js_1.Portal(this, portalName);
|
|
136
139
|
await portal.bind(options.params, options);
|
|
137
140
|
const fields = await portal.retrieveFields();
|
|
138
|
-
const typeMap = options.typeMap || GlobalTypeMap;
|
|
141
|
+
const typeMap = options.typeMap || data_type_map_js_1.GlobalTypeMap;
|
|
139
142
|
let parsers;
|
|
140
143
|
let resultFields;
|
|
141
144
|
if (fields) {
|
|
142
|
-
parsers = getParsers(typeMap, fields);
|
|
143
|
-
resultFields = wrapRowDescription(typeMap, fields, options.columnFormat || DEFAULT_COLUMN_FORMAT);
|
|
145
|
+
parsers = (0, get_parsers_js_1.getParsers)(typeMap, fields);
|
|
146
|
+
resultFields = (0, wrap_row_description_js_1.wrapRowDescription)(typeMap, fields, options.columnFormat || constants_js_1.DEFAULT_COLUMN_FORMAT);
|
|
144
147
|
result.fields = resultFields;
|
|
145
148
|
result.rowType = options.objectRows ? 'object' : 'array';
|
|
146
149
|
if (options.cursor) {
|
|
147
|
-
result.cursor = new Cursor(this, portal, resultFields, parsers, options);
|
|
150
|
+
result.cursor = new cursor_js_1.Cursor(this, portal, resultFields, parsers, options);
|
|
148
151
|
this._refCount++;
|
|
149
152
|
portal = undefined;
|
|
150
153
|
return result;
|
|
@@ -162,9 +165,9 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
162
165
|
let row;
|
|
163
166
|
for (let i = 0; i < l; i++) {
|
|
164
167
|
row = rows[i];
|
|
165
|
-
parseRow(parsers, row, options);
|
|
168
|
+
(0, parse_row_js_1.parseRow)(parsers, row, options);
|
|
166
169
|
if (options.objectRows) {
|
|
167
|
-
rows[i] = convertRowToObject(resultFields, row);
|
|
170
|
+
rows[i] = (0, convert_row_to_object_js_1.convertRowToObject)(resultFields, row);
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
173
|
}
|
|
@@ -183,7 +186,7 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
183
186
|
async _close() {
|
|
184
187
|
if (--this._refCount > 0)
|
|
185
188
|
return;
|
|
186
|
-
const intoCon = getIntlConnection(this.connection);
|
|
189
|
+
const intoCon = (0, intl_connection_js_1.getIntlConnection)(this.connection);
|
|
187
190
|
intoCon.ref();
|
|
188
191
|
try {
|
|
189
192
|
const socket = intoCon.socket;
|
|
@@ -191,12 +194,12 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
191
194
|
socket.sendSyncMessage();
|
|
192
195
|
await socket.capture(async (code, msg, done) => {
|
|
193
196
|
switch (code) {
|
|
194
|
-
case Protocol.BackendMessageCode.NoticeResponse:
|
|
197
|
+
case protocol_js_1.Protocol.BackendMessageCode.NoticeResponse:
|
|
195
198
|
this.emit('notice', msg);
|
|
196
199
|
break;
|
|
197
|
-
case Protocol.BackendMessageCode.CloseComplete:
|
|
200
|
+
case protocol_js_1.Protocol.BackendMessageCode.CloseComplete:
|
|
198
201
|
break;
|
|
199
|
-
case Protocol.BackendMessageCode.ReadyForQuery:
|
|
202
|
+
case protocol_js_1.Protocol.BackendMessageCode.ReadyForQuery:
|
|
200
203
|
intoCon.transactionStatus = msg.status;
|
|
201
204
|
done();
|
|
202
205
|
break;
|
|
@@ -214,3 +217,4 @@ export class PreparedStatement extends SafeEventEmitter {
|
|
|
214
217
|
return this.close();
|
|
215
218
|
}
|
|
216
219
|
}
|
|
220
|
+
exports.PreparedStatement = PreparedStatement;
|
package/esm/constants.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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;
|
|
3
7
|
// @ts-ignore
|
|
4
8
|
Symbol.asyncDispose ?? (Symbol.asyncDispose = Symbol('Symbol.asyncDispose'));
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export var ConnectionState;
|
|
9
|
+
exports.DEFAULT_COLUMN_FORMAT = DataFormat.binary;
|
|
10
|
+
var ConnectionState;
|
|
8
11
|
(function (ConnectionState) {
|
|
9
12
|
ConnectionState[ConnectionState["CLOSED"] = 0] = "CLOSED";
|
|
10
13
|
ConnectionState[ConnectionState["CONNECTING"] = 1] = "CONNECTING";
|
|
11
14
|
ConnectionState[ConnectionState["AUTHORIZING"] = 3] = "AUTHORIZING";
|
|
12
15
|
ConnectionState[ConnectionState["READY"] = 2] = "READY";
|
|
13
16
|
ConnectionState[ConnectionState["CLOSING"] = 10] = "CLOSING";
|
|
14
|
-
})(ConnectionState || (ConnectionState = {}));
|
|
15
|
-
|
|
17
|
+
})(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
|
|
18
|
+
exports.DataTypeOIDs = {
|
|
16
19
|
bool: 16,
|
|
17
20
|
bytea: 17,
|
|
18
21
|
char: 18,
|
|
@@ -129,119 +132,119 @@ export const DataTypeOIDs = {
|
|
|
129
132
|
_uuid: 2951,
|
|
130
133
|
_jsonb: 3807,
|
|
131
134
|
};
|
|
132
|
-
|
|
133
|
-
[DataTypeOIDs.bool]: 'bool',
|
|
134
|
-
[DataTypeOIDs.bytea]: 'bytea',
|
|
135
|
-
[DataTypeOIDs.char]: 'char',
|
|
136
|
-
[DataTypeOIDs.name]: 'name',
|
|
137
|
-
[DataTypeOIDs.int8]: 'int8',
|
|
138
|
-
[DataTypeOIDs.int2]: 'int2',
|
|
139
|
-
[DataTypeOIDs.int2vector]: 'int2vector',
|
|
140
|
-
[DataTypeOIDs.int4]: 'int4',
|
|
141
|
-
[DataTypeOIDs.regproc]: 'regproc',
|
|
142
|
-
[DataTypeOIDs.text]: 'text',
|
|
143
|
-
[DataTypeOIDs.oid]: 'oid',
|
|
144
|
-
[DataTypeOIDs.tid]: 'tid',
|
|
145
|
-
[DataTypeOIDs.xid]: 'xid',
|
|
146
|
-
[DataTypeOIDs.cid]: 'cid',
|
|
147
|
-
[DataTypeOIDs.oidvector]: 'oidvector',
|
|
148
|
-
[DataTypeOIDs.json]: 'json',
|
|
149
|
-
[DataTypeOIDs.xml]: 'xml',
|
|
150
|
-
[DataTypeOIDs.point]: 'point',
|
|
151
|
-
[DataTypeOIDs.lseg]: 'lseg',
|
|
152
|
-
[DataTypeOIDs.path]: 'path',
|
|
153
|
-
[DataTypeOIDs.box]: 'box',
|
|
154
|
-
[DataTypeOIDs.polygon]: 'polygon',
|
|
155
|
-
[DataTypeOIDs.line]: 'line',
|
|
156
|
-
[DataTypeOIDs.cidr]: 'cidr',
|
|
157
|
-
[DataTypeOIDs.float4]: 'float4',
|
|
158
|
-
[DataTypeOIDs.float8]: 'float8',
|
|
159
|
-
[DataTypeOIDs.unknown]: 'unknown',
|
|
160
|
-
[DataTypeOIDs.circle]: 'circle',
|
|
161
|
-
[DataTypeOIDs.macaddr8]: 'macaddr8',
|
|
162
|
-
[DataTypeOIDs.money]: 'money',
|
|
163
|
-
[DataTypeOIDs.macaddr]: 'macaddr',
|
|
164
|
-
[DataTypeOIDs.inet]: 'inet',
|
|
165
|
-
[DataTypeOIDs.bpchar]: 'bpchar',
|
|
166
|
-
[DataTypeOIDs.varchar]: 'varchar',
|
|
167
|
-
[DataTypeOIDs.date]: 'date',
|
|
168
|
-
[DataTypeOIDs.time]: 'time',
|
|
169
|
-
[DataTypeOIDs.timestamp]: 'timestamp',
|
|
170
|
-
[DataTypeOIDs.timestamptz]: 'timestamptz',
|
|
171
|
-
[DataTypeOIDs.interval]: 'interval',
|
|
172
|
-
[DataTypeOIDs.timetz]: 'timetz',
|
|
173
|
-
[DataTypeOIDs.bit]: 'bit',
|
|
174
|
-
[DataTypeOIDs.varbit]: 'varbit',
|
|
175
|
-
[DataTypeOIDs.numeric]: 'numeric',
|
|
176
|
-
[DataTypeOIDs.refcursor]: 'refcursor',
|
|
177
|
-
[DataTypeOIDs.regprocedure]: 'regprocedure',
|
|
178
|
-
[DataTypeOIDs.regoper]: 'regoper',
|
|
179
|
-
[DataTypeOIDs.regoperator]: 'regoperator',
|
|
180
|
-
[DataTypeOIDs.regclass]: 'regclass',
|
|
181
|
-
[DataTypeOIDs.regtype]: 'regtype',
|
|
182
|
-
[DataTypeOIDs.record]: 'record',
|
|
183
|
-
[DataTypeOIDs.cstring]: 'cstring',
|
|
184
|
-
[DataTypeOIDs.any]: 'any',
|
|
185
|
-
[DataTypeOIDs.anyarray]: 'anyarray',
|
|
186
|
-
[DataTypeOIDs.void]: 'void',
|
|
187
|
-
[DataTypeOIDs.trigger]: 'trigger',
|
|
188
|
-
[DataTypeOIDs.language_handler]: 'language_handler',
|
|
189
|
-
[DataTypeOIDs.internal]: 'internal',
|
|
190
|
-
[DataTypeOIDs.anyelement]: 'anyelement',
|
|
191
|
-
[DataTypeOIDs.anynonarray]: 'anynonarray',
|
|
192
|
-
[DataTypeOIDs.uuid]: 'uuid',
|
|
193
|
-
[DataTypeOIDs.jsonb]: 'jsonb',
|
|
194
|
-
[DataTypeOIDs.anyrange]: 'anyrange',
|
|
195
|
-
[DataTypeOIDs.int4range]: 'int4range',
|
|
196
|
-
[DataTypeOIDs.numrange]: 'numrange',
|
|
197
|
-
[DataTypeOIDs.tsrange]: 'tsrange',
|
|
198
|
-
[DataTypeOIDs.rstzrange]: 'rstzrange',
|
|
199
|
-
[DataTypeOIDs.daterange]: 'daterange',
|
|
200
|
-
[DataTypeOIDs.int8range]: 'int8range',
|
|
201
|
-
[DataTypeOIDs._xml]: '_xml',
|
|
202
|
-
[DataTypeOIDs._json]: '_json',
|
|
203
|
-
[DataTypeOIDs._xid8]: '_xid8',
|
|
204
|
-
[DataTypeOIDs._line]: '_line',
|
|
205
|
-
[DataTypeOIDs._cidr]: '_cidr',
|
|
206
|
-
[DataTypeOIDs._circle]: '_circle',
|
|
207
|
-
[DataTypeOIDs._macaddr8]: '_macaddr8',
|
|
208
|
-
[DataTypeOIDs._money]: '_money',
|
|
209
|
-
[DataTypeOIDs._bool]: '_bool',
|
|
210
|
-
[DataTypeOIDs._bytea]: '_bytea',
|
|
211
|
-
[DataTypeOIDs._char]: '_char',
|
|
212
|
-
[DataTypeOIDs._name]: '_name',
|
|
213
|
-
[DataTypeOIDs._int2]: '_int2',
|
|
214
|
-
[DataTypeOIDs._int2vector]: '_int2vector',
|
|
215
|
-
[DataTypeOIDs._int4]: '_int4',
|
|
216
|
-
[DataTypeOIDs._regproc]: '_regproc',
|
|
217
|
-
[DataTypeOIDs._text]: '_text',
|
|
218
|
-
[DataTypeOIDs._tid]: '_tid',
|
|
219
|
-
[DataTypeOIDs._xid]: '_xid',
|
|
220
|
-
[DataTypeOIDs._cid]: '_cid',
|
|
221
|
-
[DataTypeOIDs._oidvector]: '_oidvector',
|
|
222
|
-
[DataTypeOIDs._bpchar]: '_bpchar',
|
|
223
|
-
[DataTypeOIDs._varchar]: '_varchar',
|
|
224
|
-
[DataTypeOIDs._int8]: '_int8',
|
|
225
|
-
[DataTypeOIDs._point]: '_point',
|
|
226
|
-
[DataTypeOIDs._lseg]: '_lseg',
|
|
227
|
-
[DataTypeOIDs._path]: '_path',
|
|
228
|
-
[DataTypeOIDs._box]: '_box',
|
|
229
|
-
[DataTypeOIDs._float4]: '_float4',
|
|
230
|
-
[DataTypeOIDs._float8]: '_float8',
|
|
231
|
-
[DataTypeOIDs._polygon]: '_polygon',
|
|
232
|
-
[DataTypeOIDs._oid]: '_oid',
|
|
233
|
-
[DataTypeOIDs._macaddr]: '_macaddr',
|
|
234
|
-
[DataTypeOIDs._inet]: '_inet',
|
|
235
|
-
[DataTypeOIDs._timestamp]: '_timestamp',
|
|
236
|
-
[DataTypeOIDs._date]: '_date',
|
|
237
|
-
[DataTypeOIDs._time]: '_time',
|
|
238
|
-
[DataTypeOIDs._timestamptz]: '_timestamptz',
|
|
239
|
-
[DataTypeOIDs._interval]: '_interval',
|
|
240
|
-
[DataTypeOIDs._numeric]: '_numeric',
|
|
241
|
-
[DataTypeOIDs._cstring]: '_cstring',
|
|
242
|
-
[DataTypeOIDs._timetz]: '_timetz',
|
|
243
|
-
[DataTypeOIDs._bit]: '_bit',
|
|
244
|
-
[DataTypeOIDs._varbit]: '_varbit',
|
|
245
|
-
[DataTypeOIDs._uuid]: '_uuid',
|
|
246
|
-
[DataTypeOIDs._jsonb]: '_jsonb',
|
|
135
|
+
exports.DataTypeNames = {
|
|
136
|
+
[exports.DataTypeOIDs.bool]: 'bool',
|
|
137
|
+
[exports.DataTypeOIDs.bytea]: 'bytea',
|
|
138
|
+
[exports.DataTypeOIDs.char]: 'char',
|
|
139
|
+
[exports.DataTypeOIDs.name]: 'name',
|
|
140
|
+
[exports.DataTypeOIDs.int8]: 'int8',
|
|
141
|
+
[exports.DataTypeOIDs.int2]: 'int2',
|
|
142
|
+
[exports.DataTypeOIDs.int2vector]: 'int2vector',
|
|
143
|
+
[exports.DataTypeOIDs.int4]: 'int4',
|
|
144
|
+
[exports.DataTypeOIDs.regproc]: 'regproc',
|
|
145
|
+
[exports.DataTypeOIDs.text]: 'text',
|
|
146
|
+
[exports.DataTypeOIDs.oid]: 'oid',
|
|
147
|
+
[exports.DataTypeOIDs.tid]: 'tid',
|
|
148
|
+
[exports.DataTypeOIDs.xid]: 'xid',
|
|
149
|
+
[exports.DataTypeOIDs.cid]: 'cid',
|
|
150
|
+
[exports.DataTypeOIDs.oidvector]: 'oidvector',
|
|
151
|
+
[exports.DataTypeOIDs.json]: 'json',
|
|
152
|
+
[exports.DataTypeOIDs.xml]: 'xml',
|
|
153
|
+
[exports.DataTypeOIDs.point]: 'point',
|
|
154
|
+
[exports.DataTypeOIDs.lseg]: 'lseg',
|
|
155
|
+
[exports.DataTypeOIDs.path]: 'path',
|
|
156
|
+
[exports.DataTypeOIDs.box]: 'box',
|
|
157
|
+
[exports.DataTypeOIDs.polygon]: 'polygon',
|
|
158
|
+
[exports.DataTypeOIDs.line]: 'line',
|
|
159
|
+
[exports.DataTypeOIDs.cidr]: 'cidr',
|
|
160
|
+
[exports.DataTypeOIDs.float4]: 'float4',
|
|
161
|
+
[exports.DataTypeOIDs.float8]: 'float8',
|
|
162
|
+
[exports.DataTypeOIDs.unknown]: 'unknown',
|
|
163
|
+
[exports.DataTypeOIDs.circle]: 'circle',
|
|
164
|
+
[exports.DataTypeOIDs.macaddr8]: 'macaddr8',
|
|
165
|
+
[exports.DataTypeOIDs.money]: 'money',
|
|
166
|
+
[exports.DataTypeOIDs.macaddr]: 'macaddr',
|
|
167
|
+
[exports.DataTypeOIDs.inet]: 'inet',
|
|
168
|
+
[exports.DataTypeOIDs.bpchar]: 'bpchar',
|
|
169
|
+
[exports.DataTypeOIDs.varchar]: 'varchar',
|
|
170
|
+
[exports.DataTypeOIDs.date]: 'date',
|
|
171
|
+
[exports.DataTypeOIDs.time]: 'time',
|
|
172
|
+
[exports.DataTypeOIDs.timestamp]: 'timestamp',
|
|
173
|
+
[exports.DataTypeOIDs.timestamptz]: 'timestamptz',
|
|
174
|
+
[exports.DataTypeOIDs.interval]: 'interval',
|
|
175
|
+
[exports.DataTypeOIDs.timetz]: 'timetz',
|
|
176
|
+
[exports.DataTypeOIDs.bit]: 'bit',
|
|
177
|
+
[exports.DataTypeOIDs.varbit]: 'varbit',
|
|
178
|
+
[exports.DataTypeOIDs.numeric]: 'numeric',
|
|
179
|
+
[exports.DataTypeOIDs.refcursor]: 'refcursor',
|
|
180
|
+
[exports.DataTypeOIDs.regprocedure]: 'regprocedure',
|
|
181
|
+
[exports.DataTypeOIDs.regoper]: 'regoper',
|
|
182
|
+
[exports.DataTypeOIDs.regoperator]: 'regoperator',
|
|
183
|
+
[exports.DataTypeOIDs.regclass]: 'regclass',
|
|
184
|
+
[exports.DataTypeOIDs.regtype]: 'regtype',
|
|
185
|
+
[exports.DataTypeOIDs.record]: 'record',
|
|
186
|
+
[exports.DataTypeOIDs.cstring]: 'cstring',
|
|
187
|
+
[exports.DataTypeOIDs.any]: 'any',
|
|
188
|
+
[exports.DataTypeOIDs.anyarray]: 'anyarray',
|
|
189
|
+
[exports.DataTypeOIDs.void]: 'void',
|
|
190
|
+
[exports.DataTypeOIDs.trigger]: 'trigger',
|
|
191
|
+
[exports.DataTypeOIDs.language_handler]: 'language_handler',
|
|
192
|
+
[exports.DataTypeOIDs.internal]: 'internal',
|
|
193
|
+
[exports.DataTypeOIDs.anyelement]: 'anyelement',
|
|
194
|
+
[exports.DataTypeOIDs.anynonarray]: 'anynonarray',
|
|
195
|
+
[exports.DataTypeOIDs.uuid]: 'uuid',
|
|
196
|
+
[exports.DataTypeOIDs.jsonb]: 'jsonb',
|
|
197
|
+
[exports.DataTypeOIDs.anyrange]: 'anyrange',
|
|
198
|
+
[exports.DataTypeOIDs.int4range]: 'int4range',
|
|
199
|
+
[exports.DataTypeOIDs.numrange]: 'numrange',
|
|
200
|
+
[exports.DataTypeOIDs.tsrange]: 'tsrange',
|
|
201
|
+
[exports.DataTypeOIDs.rstzrange]: 'rstzrange',
|
|
202
|
+
[exports.DataTypeOIDs.daterange]: 'daterange',
|
|
203
|
+
[exports.DataTypeOIDs.int8range]: 'int8range',
|
|
204
|
+
[exports.DataTypeOIDs._xml]: '_xml',
|
|
205
|
+
[exports.DataTypeOIDs._json]: '_json',
|
|
206
|
+
[exports.DataTypeOIDs._xid8]: '_xid8',
|
|
207
|
+
[exports.DataTypeOIDs._line]: '_line',
|
|
208
|
+
[exports.DataTypeOIDs._cidr]: '_cidr',
|
|
209
|
+
[exports.DataTypeOIDs._circle]: '_circle',
|
|
210
|
+
[exports.DataTypeOIDs._macaddr8]: '_macaddr8',
|
|
211
|
+
[exports.DataTypeOIDs._money]: '_money',
|
|
212
|
+
[exports.DataTypeOIDs._bool]: '_bool',
|
|
213
|
+
[exports.DataTypeOIDs._bytea]: '_bytea',
|
|
214
|
+
[exports.DataTypeOIDs._char]: '_char',
|
|
215
|
+
[exports.DataTypeOIDs._name]: '_name',
|
|
216
|
+
[exports.DataTypeOIDs._int2]: '_int2',
|
|
217
|
+
[exports.DataTypeOIDs._int2vector]: '_int2vector',
|
|
218
|
+
[exports.DataTypeOIDs._int4]: '_int4',
|
|
219
|
+
[exports.DataTypeOIDs._regproc]: '_regproc',
|
|
220
|
+
[exports.DataTypeOIDs._text]: '_text',
|
|
221
|
+
[exports.DataTypeOIDs._tid]: '_tid',
|
|
222
|
+
[exports.DataTypeOIDs._xid]: '_xid',
|
|
223
|
+
[exports.DataTypeOIDs._cid]: '_cid',
|
|
224
|
+
[exports.DataTypeOIDs._oidvector]: '_oidvector',
|
|
225
|
+
[exports.DataTypeOIDs._bpchar]: '_bpchar',
|
|
226
|
+
[exports.DataTypeOIDs._varchar]: '_varchar',
|
|
227
|
+
[exports.DataTypeOIDs._int8]: '_int8',
|
|
228
|
+
[exports.DataTypeOIDs._point]: '_point',
|
|
229
|
+
[exports.DataTypeOIDs._lseg]: '_lseg',
|
|
230
|
+
[exports.DataTypeOIDs._path]: '_path',
|
|
231
|
+
[exports.DataTypeOIDs._box]: '_box',
|
|
232
|
+
[exports.DataTypeOIDs._float4]: '_float4',
|
|
233
|
+
[exports.DataTypeOIDs._float8]: '_float8',
|
|
234
|
+
[exports.DataTypeOIDs._polygon]: '_polygon',
|
|
235
|
+
[exports.DataTypeOIDs._oid]: '_oid',
|
|
236
|
+
[exports.DataTypeOIDs._macaddr]: '_macaddr',
|
|
237
|
+
[exports.DataTypeOIDs._inet]: '_inet',
|
|
238
|
+
[exports.DataTypeOIDs._timestamp]: '_timestamp',
|
|
239
|
+
[exports.DataTypeOIDs._date]: '_date',
|
|
240
|
+
[exports.DataTypeOIDs._time]: '_time',
|
|
241
|
+
[exports.DataTypeOIDs._timestamptz]: '_timestamptz',
|
|
242
|
+
[exports.DataTypeOIDs._interval]: '_interval',
|
|
243
|
+
[exports.DataTypeOIDs._numeric]: '_numeric',
|
|
244
|
+
[exports.DataTypeOIDs._cstring]: '_cstring',
|
|
245
|
+
[exports.DataTypeOIDs._timetz]: '_timetz',
|
|
246
|
+
[exports.DataTypeOIDs._bit]: '_bit',
|
|
247
|
+
[exports.DataTypeOIDs._varbit]: '_varbit',
|
|
248
|
+
[exports.DataTypeOIDs._uuid]: '_uuid',
|
|
249
|
+
[exports.DataTypeOIDs._jsonb]: '_jsonb',
|
|
247
250
|
};
|
package/esm/data-type-map.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
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
|
-
|
|
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 {
|
|
26
29
|
constructor(other) {
|
|
27
30
|
this._itemsByOID = {};
|
|
28
31
|
this._items = [];
|
|
@@ -45,7 +48,7 @@ export class DataTypeMap {
|
|
|
45
48
|
}
|
|
46
49
|
determine(value) {
|
|
47
50
|
if (value == null)
|
|
48
|
-
return DataTypeOIDs.unknown;
|
|
51
|
+
return constants_js_1.DataTypeOIDs.unknown;
|
|
49
52
|
const valueIsArray = Array.isArray(value);
|
|
50
53
|
let i;
|
|
51
54
|
let t;
|
|
@@ -58,58 +61,59 @@ export class DataTypeMap {
|
|
|
58
61
|
else if (!t.elementsOID && t.isType(value))
|
|
59
62
|
return t.oid;
|
|
60
63
|
}
|
|
61
|
-
return DataTypeOIDs.unknown;
|
|
64
|
+
return constants_js_1.DataTypeOIDs.unknown;
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
|
-
|
|
65
|
-
GlobalTypeMap
|
|
66
|
-
GlobalTypeMap.register([
|
|
67
|
-
GlobalTypeMap.register([
|
|
68
|
-
GlobalTypeMap.register([
|
|
69
|
-
GlobalTypeMap.register([
|
|
70
|
-
GlobalTypeMap.register([
|
|
71
|
-
GlobalTypeMap.register([
|
|
72
|
-
GlobalTypeMap.register([
|
|
73
|
-
GlobalTypeMap.register([
|
|
74
|
-
GlobalTypeMap.register([
|
|
75
|
-
GlobalTypeMap.register([
|
|
76
|
-
GlobalTypeMap.register([
|
|
77
|
-
GlobalTypeMap.register([
|
|
78
|
-
GlobalTypeMap.register([
|
|
79
|
-
GlobalTypeMap.register([
|
|
80
|
-
GlobalTypeMap.register([
|
|
81
|
-
GlobalTypeMap.register(
|
|
82
|
-
GlobalTypeMap.register({
|
|
83
|
-
|
|
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({ ...varchar_type_js_1.VarcharType, name: 'bpchar', oid: constants_js_1.DataTypeOIDs.bpchar });
|
|
86
|
+
exports.GlobalTypeMap.register({
|
|
87
|
+
...varchar_type_js_1.ArrayVarcharType,
|
|
84
88
|
name: '_bpchar',
|
|
85
|
-
oid: DataTypeOIDs._bpchar,
|
|
86
|
-
elementsOID: DataTypeOIDs.bpchar,
|
|
89
|
+
oid: constants_js_1.DataTypeOIDs._bpchar,
|
|
90
|
+
elementsOID: constants_js_1.DataTypeOIDs.bpchar,
|
|
87
91
|
});
|
|
88
|
-
GlobalTypeMap.register({ ...VarcharType, name: 'name', oid: DataTypeOIDs.name });
|
|
89
|
-
GlobalTypeMap.register({
|
|
90
|
-
...ArrayVarcharType,
|
|
92
|
+
exports.GlobalTypeMap.register({ ...varchar_type_js_1.VarcharType, name: 'name', oid: constants_js_1.DataTypeOIDs.name });
|
|
93
|
+
exports.GlobalTypeMap.register({
|
|
94
|
+
...varchar_type_js_1.ArrayVarcharType,
|
|
91
95
|
name: '_name',
|
|
92
|
-
oid: DataTypeOIDs._name,
|
|
93
|
-
elementsOID: DataTypeOIDs.name,
|
|
96
|
+
oid: constants_js_1.DataTypeOIDs._name,
|
|
97
|
+
elementsOID: constants_js_1.DataTypeOIDs.name,
|
|
94
98
|
});
|
|
95
|
-
GlobalTypeMap.register({ ...VarcharType, name: 'text', oid: DataTypeOIDs.text });
|
|
96
|
-
GlobalTypeMap.register({
|
|
97
|
-
...ArrayVarcharType,
|
|
99
|
+
exports.GlobalTypeMap.register({ ...varchar_type_js_1.VarcharType, name: 'text', oid: constants_js_1.DataTypeOIDs.text });
|
|
100
|
+
exports.GlobalTypeMap.register({
|
|
101
|
+
...varchar_type_js_1.ArrayVarcharType,
|
|
98
102
|
name: '_text',
|
|
99
|
-
oid: DataTypeOIDs._text,
|
|
100
|
-
elementsOID: DataTypeOIDs.text,
|
|
103
|
+
oid: constants_js_1.DataTypeOIDs._text,
|
|
104
|
+
elementsOID: constants_js_1.DataTypeOIDs.text,
|
|
101
105
|
});
|
|
102
|
-
GlobalTypeMap.register({ ...VarcharType, name: 'xml', oid: DataTypeOIDs.xml });
|
|
103
|
-
GlobalTypeMap.register({
|
|
104
|
-
...ArrayVarcharType,
|
|
106
|
+
exports.GlobalTypeMap.register({ ...varchar_type_js_1.VarcharType, name: 'xml', oid: constants_js_1.DataTypeOIDs.xml });
|
|
107
|
+
exports.GlobalTypeMap.register({
|
|
108
|
+
...varchar_type_js_1.ArrayVarcharType,
|
|
105
109
|
name: '_xml',
|
|
106
|
-
oid: DataTypeOIDs._xml,
|
|
107
|
-
elementsOID: DataTypeOIDs.xml,
|
|
110
|
+
oid: constants_js_1.DataTypeOIDs._xml,
|
|
111
|
+
elementsOID: constants_js_1.DataTypeOIDs.xml,
|
|
108
112
|
});
|
|
109
|
-
GlobalTypeMap.register([VarcharType, ArrayVarcharType]);
|
|
110
|
-
GlobalTypeMap.register([UuidType, ArrayUuidType]);
|
|
111
|
-
GlobalTypeMap.register([CharType, ArrayCharType]);
|
|
112
|
-
GlobalTypeMap.register([TimestamptzType, ArrayTimestamptzType]);
|
|
113
|
-
GlobalTypeMap.register([TimeType, ArrayTimeType]);
|
|
114
|
-
GlobalTypeMap.register([DateType, ArrayDateType]);
|
|
115
|
-
GlobalTypeMap.register([TimestampType, ArrayTimestampType]);
|
|
113
|
+
exports.GlobalTypeMap.register([varchar_type_js_1.VarcharType, varchar_type_js_1.ArrayVarcharType]);
|
|
114
|
+
exports.GlobalTypeMap.register([uuid_type_js_1.UuidType, uuid_type_js_1.ArrayUuidType]);
|
|
115
|
+
exports.GlobalTypeMap.register([char_type_js_1.CharType, char_type_js_1.ArrayCharType]);
|
|
116
|
+
exports.GlobalTypeMap.register([timestamptz_type_js_1.TimestamptzType, timestamptz_type_js_1.ArrayTimestamptzType]);
|
|
117
|
+
exports.GlobalTypeMap.register([time_type_js_1.TimeType, time_type_js_1.ArrayTimeType]);
|
|
118
|
+
exports.GlobalTypeMap.register([date_type_js_1.DateType, date_type_js_1.ArrayDateType]);
|
|
119
|
+
exports.GlobalTypeMap.register([timestamp_type_js_1.TimestampType, timestamp_type_js_1.ArrayTimestampType]);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 = {
|
|
3
6
|
name: 'bool',
|
|
4
|
-
oid: DataTypeOIDs.bool,
|
|
7
|
+
oid: constants_js_1.DataTypeOIDs.bool,
|
|
5
8
|
jsType: 'boolean',
|
|
6
9
|
parseBinary(v) {
|
|
7
10
|
return !!v.readUInt8();
|
|
@@ -16,9 +19,9 @@ export const BoolType = {
|
|
|
16
19
|
return typeof v === 'boolean';
|
|
17
20
|
},
|
|
18
21
|
};
|
|
19
|
-
|
|
20
|
-
...BoolType,
|
|
22
|
+
exports.ArrayBoolType = {
|
|
23
|
+
...exports.BoolType,
|
|
21
24
|
name: '_bool',
|
|
22
|
-
oid: DataTypeOIDs._bool,
|
|
23
|
-
elementsOID: DataTypeOIDs.bool,
|
|
25
|
+
oid: constants_js_1.DataTypeOIDs._bool,
|
|
26
|
+
elementsOID: constants_js_1.DataTypeOIDs.bool,
|
|
24
27
|
};
|