@trenskow/pged 4.0.2 → 4.0.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/query-builder.js +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/pged",
3
- "version": "4.0.2",
3
+ "version": "4.0.6",
4
4
  "description": "Just a silly little db management and query builder for PostgreSQL.",
5
5
  "main": "index.js",
6
6
  "scripts": {
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 = Infinity) {
132
+ limitTo(limit) {
134
133
  this._limit = limit;
135
134
  return this;
136
135
  }
@@ -280,7 +279,8 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
280
279
  $gte: '>=',
281
280
  $regexp: '~*',
282
281
  $jsonContains: '@>',
283
- $jsonNotContains: '@>'
282
+ $jsonNotContains: '@>',
283
+ $jsonArrayContains: '?'
284
284
  };
285
285
  }
286
286
 
@@ -321,6 +321,7 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
321
321
  case '$regexp':
322
322
  case '$jsonContains':
323
323
  case '$jsonNotContains':
324
+ case '$jsonArrayContains':
324
325
  return this._buildConditions(condition[key], operator, key, true);
325
326
  default:
326
327
  throw new TypeError(`Unknown modifier ${caseit(key)}.`);
@@ -419,7 +420,7 @@ module.exports = exports = class QueryBuilder extends CustomPromise {
419
420
  }
420
421
 
421
422
  _buildLimit() {
422
- if ((this._limit || Infinity) == Infinity) return;
423
+ if (typeof this._limit === 'undefined') return;
423
424
  return `limit ${this._limit}`;
424
425
  }
425
426