@trenskow/pged 4.0.3 → 4.0.7
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/package.json +1 -1
- package/query-builder.js +4 -5
package/package.json
CHANGED
package/query-builder.js
CHANGED
|
@@ -35,7 +35,6 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
|
|
|
35
35
|
this._having = [];
|
|
36
36
|
|
|
37
37
|
this._offset = 0;
|
|
38
|
-
this._limit = Infinity;
|
|
39
38
|
|
|
40
39
|
this._executor = executor;
|
|
41
40
|
|
|
@@ -130,7 +129,7 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
|
|
|
130
129
|
return this;
|
|
131
130
|
}
|
|
132
131
|
|
|
133
|
-
limitTo(limit
|
|
132
|
+
limitTo(limit) {
|
|
134
133
|
this._limit = limit;
|
|
135
134
|
return this;
|
|
136
135
|
}
|
|
@@ -259,7 +258,7 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
|
|
|
259
258
|
let as = key.split(':');
|
|
260
259
|
if (as.length == 1) return this._dbCase(as[0], quote && this._canQuote(key));
|
|
261
260
|
return `${this._dbCase(as[0], quote)} as ${this._dbCase(as[1])}`;
|
|
262
|
-
}).concat(this._paginated ?
|
|
261
|
+
}).concat(this._paginated ? `count(${this._table}.*) over() as total` : []).join(', ');
|
|
263
262
|
}
|
|
264
263
|
|
|
265
264
|
get _operatorMap() {
|
|
@@ -322,7 +321,7 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
|
|
|
322
321
|
case '$regexp':
|
|
323
322
|
case '$jsonContains':
|
|
324
323
|
case '$jsonNotContains':
|
|
325
|
-
case 'jsonArrayContains':
|
|
324
|
+
case '$jsonArrayContains':
|
|
326
325
|
return this._buildConditions(condition[key], operator, key, true);
|
|
327
326
|
default:
|
|
328
327
|
throw new TypeError(`Unknown modifier ${caseit(key)}.`);
|
|
@@ -421,7 +420,7 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
|
|
|
421
420
|
}
|
|
422
421
|
|
|
423
422
|
_buildLimit() {
|
|
424
|
-
if (
|
|
423
|
+
if (typeof this._limit === 'undefined') return;
|
|
425
424
|
return `limit ${this._limit}`;
|
|
426
425
|
}
|
|
427
426
|
|