feat: add capability for insert multiple rows in single query#1985
feat: add capability for insert multiple rows in single query#1985dhmlau merged 1 commit intoloopbackio:masterfrom
Conversation
Pull Request Test Coverage Report for Build 3167967406
💛 - Coveralls |
4944cbf to
6f42e1f
Compare
fd20c9d to
a86b063
Compare
|
loopback-connector release is needed before it can be merged. However, this can be reviewed until then. |
Signed-off-by: Samarpan Bhattacharya <this.is.samy@gmail.com>
a86b063 to
6ed63ea
Compare
|
Updated connector version after rebase. |
|
@raymondfeng @achrinza @dhmlau Please review. |
dhmlau
left a comment
There was a problem hiding this comment.
@samarpanB, thanks for the PR. Your changes look reasonable to me. I have 2 minor comments, please review.
Before merging this PR, I'd like to get @raymondfeng or one more maintainer to approve. Thanks.
|
|
||
| hookMonitor.names.should.eql([ | ||
| 'before save', | ||
| 'before save', |
There was a problem hiding this comment.
It duplicates with the line above. Do we need it?
There was a problem hiding this comment.
Yes, thats how the hooks used to work previously as well, when inserting multiple records in create method. For each entry in the array of records to be inserted, before save and after save hooks independently. SO as many records, that many hooks triggered. I kept the behaviour same. There are some data validation logic which is useful if triggered for each entry separately.
| 'persist', | ||
| 'loaded', | ||
| 'after save', | ||
| 'after save', |
|
@dhmlau I replied to your comment. Can you please check if I need to change the behaviour ? |
|
@samarpanB, thanks for your response. LGTM. Since I have the "go ahead" from @achrinza as well, I'll be merging this PR. Thanks! |
Signed-off-by: Samarpan Bhattacharya this.is.samy@gmail.com
Adds new createAll method to support insert multiple rows in single query in memory connector
Enables multiInsertSupport in memory connector
Adds capability to createAll in dao.js for models to do multiple insert in one query via the supported connectors
Fixes loopbackio/loopback-connector#227
See also loopbackio/loopback-next#3357
Checklist
npm testpasses on your machine