pg-promise 11.8.0 → 11.9.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/lib/main.js
CHANGED
|
@@ -36,6 +36,7 @@ const npm = {
|
|
|
36
36
|
* @param {array} [options.values] - See property {@link ParameterizedQuery#values values}.
|
|
37
37
|
* @param {boolean} [options.binary] - See property {@link ParameterizedQuery#binary binary}.
|
|
38
38
|
* @param {string} [options.rowMode] - See property {@link ParameterizedQuery#rowMode rowMode}.
|
|
39
|
+
* @param {ITypes} [options.types] - See property {@link ParameterizedQuery#types types}.
|
|
39
40
|
*
|
|
40
41
|
* @returns {ParameterizedQuery}
|
|
41
42
|
*
|
|
@@ -91,7 +92,7 @@ class ParameterizedQuery extends ServerFormatting {
|
|
|
91
92
|
text: options
|
|
92
93
|
};
|
|
93
94
|
} else {
|
|
94
|
-
options = assert(options, ['text', 'values', 'binary', 'rowMode']);
|
|
95
|
+
options = assert(options, ['text', 'values', 'binary', 'rowMode', 'types']);
|
|
95
96
|
}
|
|
96
97
|
super(options);
|
|
97
98
|
}
|
|
@@ -148,6 +149,10 @@ ParameterizedQuery.prototype.parse = function () {
|
|
|
148
149
|
_i.target.rowMode = options.rowMode;
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
if (options.types !== undefined) {
|
|
153
|
+
_i.target.types = options.types;
|
|
154
|
+
}
|
|
155
|
+
|
|
151
156
|
if (errors.length) {
|
|
152
157
|
return _i.currentError = new ParameterizedQueryError(errors[0], _i.target);
|
|
153
158
|
}
|
|
@@ -238,6 +243,14 @@ module.exports = {ParameterizedQuery};
|
|
|
238
243
|
* - `array` will make all data rows arrive as arrays of values. By default, rows arrive as objects.
|
|
239
244
|
*/
|
|
240
245
|
|
|
246
|
+
/**
|
|
247
|
+
* @name ParameterizedQuery#types
|
|
248
|
+
* @type {ITypes}
|
|
249
|
+
* @default undefined
|
|
250
|
+
* @description
|
|
251
|
+
* Custom type parsers just for this query result.
|
|
252
|
+
*/
|
|
253
|
+
|
|
241
254
|
/**
|
|
242
255
|
* @name ParameterizedQuery#error
|
|
243
256
|
* @type {errors.ParameterizedQueryError}
|
|
@@ -38,6 +38,7 @@ const npm = {
|
|
|
38
38
|
* @param {boolean} [options.binary] - See property {@link PreparedStatement#binary binary}.
|
|
39
39
|
* @param {string} [options.rowMode] - See property {@link PreparedStatement#rowMode rowMode}.
|
|
40
40
|
* @param {number} [options.rows] - See property {@link PreparedStatement#rows rows}.
|
|
41
|
+
* @param {ITypes} [options.types] - See property {@link PreparedStatement#types types}.
|
|
41
42
|
*
|
|
42
43
|
* @returns {PreparedStatement}
|
|
43
44
|
*
|
|
@@ -89,7 +90,7 @@ const npm = {
|
|
|
89
90
|
*/
|
|
90
91
|
class PreparedStatement extends ServerFormatting {
|
|
91
92
|
constructor(options) {
|
|
92
|
-
options = assert(options, ['name', 'text', 'values', 'binary', 'rowMode', 'rows']);
|
|
93
|
+
options = assert(options, ['name', 'text', 'values', 'binary', 'rowMode', 'rows', 'types']);
|
|
93
94
|
super(options);
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -192,6 +193,10 @@ PreparedStatement.prototype.parse = function () {
|
|
|
192
193
|
_i.target.rows = options.rows;
|
|
193
194
|
}
|
|
194
195
|
|
|
196
|
+
if (options.types !== undefined) {
|
|
197
|
+
_i.target.types = options.types;
|
|
198
|
+
}
|
|
199
|
+
|
|
195
200
|
if (errors.length) {
|
|
196
201
|
return _i.currentError = new PreparedStatementError(errors[0], _i.target);
|
|
197
202
|
}
|
|
@@ -289,6 +294,14 @@ module.exports = {PreparedStatement};
|
|
|
289
294
|
* - `array` will make all data rows arrive as arrays of values. By default, rows arrive as objects.
|
|
290
295
|
*/
|
|
291
296
|
|
|
297
|
+
/**
|
|
298
|
+
* @name PreparedStatement#types
|
|
299
|
+
* @type {ITypes}
|
|
300
|
+
* @default undefined
|
|
301
|
+
* @description
|
|
302
|
+
* Custom type parsers just for this query result.
|
|
303
|
+
*/
|
|
304
|
+
|
|
292
305
|
/**
|
|
293
306
|
* @name PreparedStatement#error
|
|
294
307
|
* @type {errors.PreparedStatementError}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-promise",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.9.0",
|
|
4
4
|
"description": "PostgreSQL interface for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "typescript/pg-promise.d.ts",
|
|
@@ -42,24 +42,24 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"assert-options": "0.8.1",
|
|
45
|
-
"pg": "8.
|
|
45
|
+
"pg": "8.12.0",
|
|
46
46
|
"pg-minify": "1.6.4",
|
|
47
47
|
"spex": "3.3.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@eslint/js": "9.
|
|
51
|
-
"@types/node": "20.
|
|
50
|
+
"@eslint/js": "9.6.0",
|
|
51
|
+
"@types/node": "20.14.9",
|
|
52
52
|
"bluebird": "3.7.2",
|
|
53
53
|
"coveralls": "3.1.1",
|
|
54
|
-
"cspell": "8.
|
|
55
|
-
"eslint": "9.
|
|
56
|
-
"globals": "15.
|
|
54
|
+
"cspell": "8.10.0",
|
|
55
|
+
"eslint": "9.6.0",
|
|
56
|
+
"globals": "15.8.0",
|
|
57
57
|
"istanbul": "0.4.5",
|
|
58
58
|
"jasmine-node": "3.0.0",
|
|
59
59
|
"jsdoc": "4.0.3",
|
|
60
60
|
"JSONStream": "1.3.5",
|
|
61
|
-
"pg-query-stream": "4.
|
|
61
|
+
"pg-query-stream": "4.6.0",
|
|
62
62
|
"tslint": "6.1.3",
|
|
63
|
-
"typescript": "5.
|
|
63
|
+
"typescript": "5.5.3"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
// Follow the links below:
|
|
16
16
|
// https://stackoverflow.com/questions/36593087/using-a-custom-promise-as-a-generic-type
|
|
17
17
|
// https://github.com/Microsoft/TypeScript/issues/1213
|
|
18
|
+
|
|
18
19
|
type XPromise<T> = Promise<T>;
|
|
19
20
|
|
|
20
21
|
import * as pg from './pg-subset';
|
|
@@ -79,6 +80,7 @@ declare namespace pgPromise {
|
|
|
79
80
|
binary?: boolean
|
|
80
81
|
rowMode?: 'array' | null | void
|
|
81
82
|
rows?: number
|
|
83
|
+
types?: pg.ITypes
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
interface IParameterizedQuery {
|
|
@@ -86,6 +88,7 @@ declare namespace pgPromise {
|
|
|
86
88
|
values?: any[]
|
|
87
89
|
binary?: boolean
|
|
88
90
|
rowMode?: void | 'array'
|
|
91
|
+
types?: pg.ITypes;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
interface IPreparedParsed {
|
|
@@ -248,6 +251,7 @@ declare namespace pgPromise {
|
|
|
248
251
|
binary: boolean;
|
|
249
252
|
rowMode: void | 'array';
|
|
250
253
|
rows: number;
|
|
254
|
+
types: pg.ITypes;
|
|
251
255
|
|
|
252
256
|
parse(): IPreparedParsed | errors.PreparedStatementError
|
|
253
257
|
|
|
@@ -267,6 +271,7 @@ declare namespace pgPromise {
|
|
|
267
271
|
// advanced properties:
|
|
268
272
|
binary: boolean;
|
|
269
273
|
rowMode: void | 'array';
|
|
274
|
+
types: pg.ITypes;
|
|
270
275
|
|
|
271
276
|
parse(): IParameterizedParsed | errors.ParameterizedQueryError
|
|
272
277
|
|