@1auth/store-sql 0.0.0-alpha.52 → 0.0.0-alpha.54
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/index.js +12 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -90,7 +90,12 @@ export const insertList = async (table, rows = []) => {
|
|
|
90
90
|
let insertParameters = []
|
|
91
91
|
for (let i = 0, l = rows.length; i < l; i++) {
|
|
92
92
|
const values = rows[i]
|
|
93
|
-
const { insert, parameters } = makeSqlParts(
|
|
93
|
+
const { insert, parameters } = makeSqlParts(
|
|
94
|
+
{},
|
|
95
|
+
values,
|
|
96
|
+
[],
|
|
97
|
+
i * Object.keys(values).length + 1
|
|
98
|
+
)
|
|
94
99
|
if (i) {
|
|
95
100
|
insertValues.push(insert.split('VALUES')[1]) // (?)
|
|
96
101
|
} else {
|
|
@@ -149,9 +154,13 @@ const parseValues = (values) => {
|
|
|
149
154
|
export const getPlaceholder = (idx) => {
|
|
150
155
|
return options.placeholder === '$' ? '$' + idx : options.placeholder
|
|
151
156
|
}
|
|
152
|
-
export const makeSqlParts = (
|
|
157
|
+
export const makeSqlParts = (
|
|
158
|
+
filters = {},
|
|
159
|
+
values = {},
|
|
160
|
+
fields = [],
|
|
161
|
+
idx = 1
|
|
162
|
+
) => {
|
|
153
163
|
let parameters = []
|
|
154
|
-
let idx = 1
|
|
155
164
|
const keys = Object.keys(values)
|
|
156
165
|
|
|
157
166
|
const select = fields.length ? '"' + fields.join('", "') + '"' : '*'
|