A small tool that formats a query and an array or parameters into a batch query.
npm install @dvo/batch-query
let query =
'REPLACE INTO common_surnames
(america, spain, korea)
VALUES
(?,?,Kim)'
`
could be combined with data like
`
let data = [
['Johnson', 'Gutierrez'],
['Lee', 'Pança'],
['McDonald', 'Plata']
]
`
when called with batchQuery( query, data ) to produce the results
`
let formattedQuery =
'REPLACE INTO common_surnames
(america, spain, korea)
VALUES
(Johnson,Gutierrez,Kim),
(Lee,Pança,Kim),
(McDonald,Plata,Kim)'
``