Skip to content
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

DataService - Add ability to batch actions (create, update, delete) #1995

Open
tejaede opened this issue Aug 1, 2018 · 0 comments
Open

DataService - Add ability to batch actions (create, update, delete) #1995

tejaede opened this issue Aug 1, 2018 · 0 comments

Comments

@tejaede
Copy link
Collaborator

tejaede commented Aug 1, 2018

This would accomplish 2 goals:

  1. Simplify API when developer needs to work with many objects at once. (e.g. Promise.all() wouldn't be needed by the caller)
  2. Enable implementation of Transactions

Phase 1

Batch actions of the same type

myService.saveDataObjects([objectToCreateA, objectToUpdateB, objectToUpdateC])

myService.deleteDataObjects([objectToDeleteD, objectToDeleteE, objectToDeleteF])

Phase 2

Batch actions of any type

// Either complete all of the below operations or rollback them all
myService.batch(
      myService.saveDataObjects([objectToCreateA, objectToUpdateB, objectToUpdateC]),
      myService.deleteDataObjects([objectToDeleteD, objectToDeleteE, objectToDeleteF])
)

The above snippets are meant to illustrate the use cases and are not meant to be interpreted as final method recommendations. Please suggest changes or alternatives freely below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant