Skip to content

Commit 6a682af

Browse files
null safe fallback added on insert / update / upsert,
code optimized, placeholder support for identifiers patched again, object freezing removed
1 parent 8bbb592 commit 6a682af

File tree

5 files changed

+147
-110
lines changed

5 files changed

+147
-110
lines changed

defs/types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
* Switch object
155155
* @typedef {Object} SwitchObject
156156
* @prop {Array<WhenThenCondition>} check
157-
* @prop {ValuesObject} [else]
157+
* @prop {ValuesObject} else
158158
* @prop {string} [as]
159159
*/
160160

helpers/console.helper.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
const colors = Object.freeze({
1+
const colors = {
22
reset: "\x1b[0m",
33
red: "\x1b[31m",
44
green: "\x1b[32m",
55
yellow: "\x1b[33m",
66
blue: "\x1b[34m",
77
cyan: "\x1b[36m",
8-
})
9-
8+
}
109

1110
const handleQueryDebug = (debug, sql, values, prepared = '') => {
1211
if (debug === true || debug === 'benchmark-query' || debug == 'query') {

helpers/constants.helper.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const checkConstants = value => (value != null && value.toString().includes('*')) || 'pi' === value || 'now' === value || 'currentDate' === value || 'currentTime' === value || 'currentTimestamp' === value || 'localTime' === value || 'localTimestamp' === value || 'utcTimestamp' === value || 'isNull' === value || 'isNotNull' === value || 'null' === value || 'NULL' === value || null === value
22

3-
const constantFunctions = Object.freeze({
3+
const constantFunctions = {
44
now: 'NOW()',
55
currentDate: 'CURRENT_DATE',
66
currentTime: 'CURRENT_TIME',
@@ -12,9 +12,9 @@ const constantFunctions = Object.freeze({
1212
null: 'IS NULL',
1313
isNull: 'IS NULL',
1414
isNotNull: 'IS NOT NULL'
15-
})
15+
}
1616

17-
const dataTypes = Object.freeze({
17+
const dataTypes = {
1818
date: 'DATE',
1919
dateTime: 'DATETIME',
2020
time: 'TIME',
@@ -24,14 +24,14 @@ const dataTypes = Object.freeze({
2424
signed: 'SIGNED',
2525
unsigned: 'UNSIGNED',
2626
binary: 'BINARY',
27-
})
27+
}
2828

29-
const aggregateFunctions = Object.freeze({
29+
const aggregateFunctions = {
3030
sum: 'SUM',
3131
avg: 'AVG',
3232
count: 'COUNT',
3333
max: 'MAX',
3434
min: 'MIN',
35-
})
35+
}
3636

3737
module.exports = { checkConstants, dataTypes, constantFunctions, aggregateFunctions }

0 commit comments

Comments
 (0)