@dvo/batch-query

1.0.8 • Public • Published

@dvo/batch-query

This tool is meant to merge a mySQL query and a data array into a formatted query that does what it needs in batch. For example, the 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)'

/@dvo/batch-query/

    Package Sidebar

    Install

    npm i @dvo/batch-query

    Weekly Downloads

    2

    Version

    1.0.8

    License

    ISC

    Unpacked Size

    2.86 kB

    Total Files

    3

    Last publish

    Collaborators

    • isacvale
    • ndvo