pure-orm 2.2.0 → 2.3.0
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/src/bo/base-bo.js +4 -4
package/package.json
CHANGED
package/src/bo/base-bo.js
CHANGED
|
@@ -283,13 +283,13 @@ module.exports = ({ getBusinessObjects }) =>
|
|
|
283
283
|
getSqlInsertParts() {
|
|
284
284
|
const columns = this.constructor.sqlColumns
|
|
285
285
|
.filter(
|
|
286
|
-
(column, index) => this[this.constructor.columns[index]]
|
|
286
|
+
(column, index) => this[this.constructor.columns[index]] !== void 0
|
|
287
287
|
)
|
|
288
288
|
.map(col => `"${col}"`)
|
|
289
289
|
.join(', ');
|
|
290
290
|
const values = this.constructor.columns
|
|
291
291
|
.map(column => this[column])
|
|
292
|
-
.filter(value => value
|
|
292
|
+
.filter(value => value !== void 0);
|
|
293
293
|
const valuesVar = values.map((value, index) => `$${index + 1}`);
|
|
294
294
|
return { columns, values, valuesVar };
|
|
295
295
|
}
|
|
@@ -297,14 +297,14 @@ module.exports = ({ getBusinessObjects }) =>
|
|
|
297
297
|
getSqlUpdateParts(on = 'id') {
|
|
298
298
|
const clauseArray = this.constructor.sqlColumns
|
|
299
299
|
.filter(
|
|
300
|
-
(sqlColumn, index) => this[this.constructor.columns[index]]
|
|
300
|
+
(sqlColumn, index) => this[this.constructor.columns[index]] !== void 0
|
|
301
301
|
)
|
|
302
302
|
.map((sqlColumn, index) => `"${sqlColumn}" = $${index + 1}`);
|
|
303
303
|
const clause = clauseArray.join(', ');
|
|
304
304
|
const idVar = `$${clauseArray.length + 1}`;
|
|
305
305
|
const _values = this.constructor.columns
|
|
306
306
|
.map(column => this[column])
|
|
307
|
-
.filter(value => value
|
|
307
|
+
.filter(value => value !== void 0);
|
|
308
308
|
const values = [..._values, this[on]];
|
|
309
309
|
return { clause, idVar, values };
|
|
310
310
|
}
|