@trenskow/pged 5.1.38 → 5.1.39
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/query-builder.js +5 -7
- package/package.json +1 -1
package/lib/query-builder.js
CHANGED
|
@@ -60,7 +60,7 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
60
60
|
|
|
61
61
|
_resolveConstruct(construct, transforms) {
|
|
62
62
|
if (typeof construct === 'string') {
|
|
63
|
-
if (construct[0] === ':') return this._dbCase(construct.substring(1))
|
|
63
|
+
if (construct[0] === ':') return this._dbCase(construct.substring(1));
|
|
64
64
|
else {
|
|
65
65
|
this._queryParameters = (this._queryParameters || []).concat([construct]);
|
|
66
66
|
return `$${this._queryParameters.length}`;
|
|
@@ -271,7 +271,7 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
271
271
|
parameters: (language ? [language] : []).concat([query])
|
|
272
272
|
}
|
|
273
273
|
})
|
|
274
|
-
})
|
|
274
|
+
});
|
|
275
275
|
}
|
|
276
276
|
this._conditions = this._conditions.concat(this._formalizeConditions(conditions));
|
|
277
277
|
return this;
|
|
@@ -373,7 +373,7 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
373
373
|
return (this._distinct ? [this._distinct === true ? 'distinct' : `distinct on (${this._dbCase(this._distinct)})`] : []).concat(keys.map((key) => {
|
|
374
374
|
if (typeof key === 'object' && key !== null && !Array.isArray(key)) return this._resolveConstruct(key, {
|
|
375
375
|
alias: ({ name, value }) => `${this._resolveConstruct(value)} as ${name}`
|
|
376
|
-
})
|
|
376
|
+
});
|
|
377
377
|
if (key.substring(0, 1) == ':') return key.substring(1);
|
|
378
378
|
let as = key.split(':');
|
|
379
379
|
if (as.length == 1) return this._dbCase(as[0], quote && this._canQuote(key));
|
|
@@ -441,7 +441,7 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
441
441
|
comparison: ({ lhs, operator, rhs }) => {
|
|
442
442
|
return `${this._resolveConstruct(lhs)} ${operator} ${this._resolveConstruct(rhs)}`;
|
|
443
443
|
}
|
|
444
|
-
})
|
|
444
|
+
});
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
let key = Object.keys(condition)[0];
|
|
@@ -733,8 +733,6 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
733
733
|
|
|
734
734
|
const [query, parameters] = this._build();
|
|
735
735
|
|
|
736
|
-
console.info(query);
|
|
737
|
-
|
|
738
736
|
let rows = await this._connection.exec(
|
|
739
737
|
query,
|
|
740
738
|
parameters,
|
|
@@ -767,7 +765,7 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
767
765
|
.catch((error) => this._reject(error));
|
|
768
766
|
|
|
769
767
|
return super
|
|
770
|
-
.then(resolve, reject)
|
|
768
|
+
.then(resolve, reject);
|
|
771
769
|
|
|
772
770
|
}
|
|
773
771
|
|