jeremydaly / data-api-client

A "DocumentClient" for the Amazon Aurora Serverless Data API
MIT License
444 stars 63 forks source link

Batch query update is only updating the first item #17

Closed nickygb closed 5 years ago

nickygb commented 5 years ago

I'm trying to use batch query update but I cannot make it update all the items from the parameters array:

If I have machine (id 7501) with name: 'machine7501' and machine (id 7502) with name: 'machine7502' and run the following query

await this.dataApiClient.query(
  `UPDATE machine SET ${Object.keys(machine).map(key => `${key}=:${key}`)}
  WHERE id=:id`,
  [
    [{
      id: 7501, name: 'new_machine7501',
    }],
    [{
      id: 7502, name: 'new_machine7502',
    }],
  ],
);

I expect to both names to be updated (new_machine7501 and new_machine7502) respectively but the query only update the machine with 7501.

nickygb commented 5 years ago

Sorry is the same as #5