@trenskow/pged 5.1.19 → 5.1.21
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 +2 -2
- package/query-builder.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trenskow/pged",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.21",
|
|
4
4
|
"description": "Just a silly little db management and query builder for PostgreSQL.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"homepage": "https://github.com/trenskow/pged#readme",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@trenskow/async-event-emitter": "^0.1.24",
|
|
27
|
-
"@trenskow/caseit": "^1.3.
|
|
27
|
+
"@trenskow/caseit": "^1.3.14",
|
|
28
28
|
"@trenskow/custom-promise": "^0.12.0",
|
|
29
29
|
"@trenskow/parse": "^0.1.21",
|
|
30
30
|
"pg": "^8.12.0",
|
package/query-builder.js
CHANGED
|
@@ -398,6 +398,15 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
398
398
|
if (typeof value === 'string' && value.substring(0, 1) == ':') {
|
|
399
399
|
value = this._dbCase(condition[key].substring(1));
|
|
400
400
|
} else {
|
|
401
|
+
if (value == null || typeof value === 'undefined') {
|
|
402
|
+
if (comparer === '$eq') {
|
|
403
|
+
return `${this._dbCase(key.substring(1), true)} is null`;
|
|
404
|
+
} else if (comparer === '$neq' || comparer === '$ne') {
|
|
405
|
+
return `${this._dbCase(key.substring(1), true)} is not null`;
|
|
406
|
+
} else {
|
|
407
|
+
throw new TypeError(`Comparer ${comparer} is not usable with \`null\` values.`);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
401
410
|
this._queryParameters.push(this._formatParameter(key, condition[key]));
|
|
402
411
|
value = `$${this._queryParameters.length}`;
|
|
403
412
|
}
|