[Feature Request] get all new ids when batch insert
Open
Inactive
- Dominant language
- TypeScript
- Stars
- 19k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
## 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.
Contributor guide
Assessment
This issue has not been assessed yet.