postgrejs 3.5.0 → 3.6.1
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 +40 -1
- package/README.md +22 -4
- package/connection/connection.js +13 -7
- package/connection/cursor.js +22 -1
- package/connection/intl-connection.d.ts +1 -1
- package/connection/intl-connection.js +110 -41
- package/connection/pool.d.ts +22 -0
- package/connection/pool.js +73 -9
- package/connection/portal.d.ts +1 -1
- package/connection/portal.js +3 -2
- package/connection/prepared-statement.js +8 -4
- package/data-type-map.d.ts +11 -0
- package/data-type-map.js +20 -2
- package/data-types/char-type.js +15 -0
- package/data-types/date-type.js +4 -18
- package/data-types/float4-type.js +79 -1
- package/data-types/json-type.js +7 -12
- package/data-types/jsonb-type.js +7 -12
- package/data-types/time-type.js +2 -15
- package/data-types/timestamp-type.js +8 -29
- package/data-types/timestamptz-type.js +7 -31
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/interfaces/batch-result.d.ts +1 -1
- package/interfaces/command-result.d.ts +21 -1
- package/interfaces/data-mapping-options.d.ts +16 -0
- package/interfaces/data-type.d.ts +11 -0
- package/interfaces/query-options.d.ts +25 -3
- package/package.json +1 -1
- package/protocol/connection-lost-error.d.ts +40 -0
- package/protocol/connection-lost-error.js +54 -0
- package/protocol/frontend.d.ts +7 -0
- package/protocol/frontend.js +5 -3
- package/protocol/pg-socket.d.ts +7 -0
- package/protocol/pg-socket.js +26 -2
- package/util/channel-name.d.ts +24 -0
- package/util/channel-name.js +44 -0
- package/util/get-parsers.d.ts +2 -1
- package/util/get-parsers.js +16 -1
- package/util/resolve-column-formats.d.ts +33 -0
- package/util/resolve-column-formats.js +67 -0
- package/util/wrap-row-description.d.ts +2 -1
- package/util/wrap-row-description.js +7 -1
|
@@ -9,7 +9,8 @@ const DataTypeOIDByName = {};
|
|
|
9
9
|
for (const oid of Object.keys(DataTypeNames)) {
|
|
10
10
|
DataTypeOIDByName[DataTypeNames[oid]] = Number(oid);
|
|
11
11
|
}
|
|
12
|
-
export function wrapRowDescription(typeMap, fields, columnFormat) {
|
|
12
|
+
export function wrapRowDescription(typeMap, fields, columnFormat, mappingOptions) {
|
|
13
|
+
const asString = mappingOptions?.fetchAsString;
|
|
13
14
|
return fields.map((f, idx) => {
|
|
14
15
|
const cf = Array.isArray(columnFormat) ? columnFormat[idx] : columnFormat;
|
|
15
16
|
const x = {
|
|
@@ -35,6 +36,11 @@ export function wrapRowDescription(typeMap, fields, columnFormat) {
|
|
|
35
36
|
if (reg) {
|
|
36
37
|
x.jsType = reg.jsType;
|
|
37
38
|
}
|
|
39
|
+
// A column the caller asked for as a string is handed back exactly as
|
|
40
|
+
// the server rendered it, whatever the registered type would otherwise
|
|
41
|
+
// have produced - including an array, which comes back as the literal.
|
|
42
|
+
if (asString && asString.includes(x.dataTypeId))
|
|
43
|
+
x.jsType = 'string';
|
|
38
44
|
return x;
|
|
39
45
|
});
|
|
40
46
|
}
|