@trenskow/pged 5.0.14 → 5.0.16
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 +9 -7
package/package.json
CHANGED
package/query-builder.js
CHANGED
|
@@ -67,11 +67,13 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
select(keys = ['*']) {
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
if (typeof keys !== 'string' || keys[0] !== ':') {
|
|
71
|
+
if (!Array.isArray(keys)) {
|
|
72
|
+
keys = [].concat(...keys.split('"').map((key, idx) => {
|
|
73
|
+
if (idx % 2 == 0) return key.split(/, ?/);
|
|
74
|
+
return [key];
|
|
75
|
+
})).filter((key) => key);
|
|
76
|
+
}
|
|
75
77
|
}
|
|
76
78
|
this._selectKeys = (this._selectKeys || []).concat(keys);
|
|
77
79
|
return this;
|
|
@@ -472,7 +474,7 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
472
474
|
_buildUpdateKeysAndValues(keys, values) {
|
|
473
475
|
return `set ${keys.map((key, idx) => {
|
|
474
476
|
let value = values[idx];
|
|
475
|
-
if (
|
|
477
|
+
if (value == null) {
|
|
476
478
|
value = 'null';
|
|
477
479
|
} else if (/^:/.test(value)) {
|
|
478
480
|
value = value.substring(1);
|
|
@@ -637,4 +639,4 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
637
639
|
.catch((error) => this._reject(error));
|
|
638
640
|
}
|
|
639
641
|
|
|
640
|
-
}
|
|
642
|
+
}
|