egg
egg copied to clipboard
[Feature Request] get all new ids when batch insert
Background
I use egg-mysql. insert into table (column1, column2) values(value1, value2), (value3, value4), (value5, value6);
I want to get insertId of all new inserted columns from the result. But I can't only get the id of the first row.
Proposal
Can I get ids of every new row? Like this: const result = this.app.mysql.query('insert into photo (user_id, name) values(?, ?), (?, ?), (?, ?)', ['xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx']); const [id1, id2, id3] = result.insertIds;
Or provide an efficient way to insert in batches.