-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request for a method to update entity after save #3
Comments
@NejcHorvat could you explain more? When you save is the new object to returned in the callback for save? |
@mcdonnelldean yes. When you save the store would return the saved object so that the entity could be updated with any mutated values. |
@NejcHorvat I'm not understanding the requirement. Could you explain it more. Are you asking to have an |
@mcdonnelldean what @NejcHorvat means is this:
seneca.make('supplier').data$({name: 'Company', taxNumber: '123-ABC'})
.save$(function (err, entity) {
assert(entity.id > 0)
assert.strictEqual(entity.flag, true)
assert.equals(entity.taxCode, 'A')
}); |
I'm sorry for not replying to you @mcdonnelldean, had a few super busy months and the project I had this requirement for had to go on the back burner. What @indr said is correct. This is what I had in mind. |
@indr @NejcHorvat Is this not what it does already? |
@mcdonnelldean I don't know. Didn't look at the source or test it. It also isn't the @NejcHorvat What store did you use? |
the returned entity (via callback) should reflect whatever is in the database - this is store implementation dependent however - adding an issue to the store test suite |
Would it be possible to introduce a mechanism for updating the entity with a result from the store that saved it?
Three use cases:
Postgres example would be just adding RETURN * at the end of a save / update. The returned item could be appended to the result and applied on the entity.
What would be the preferred approach for this? I am willing to create a pull for this but would like to hear your opinion on this and maybe get a few pointers or thoughts.
The text was updated successfully, but these errors were encountered: