You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm making a write call in my application to create multiple items in multiple tables. I'm using a transact write for this, since BatchWrite AFAICT isn't supported on multiple entities. I'd love to get the item that was successfully created in the response from the transact write call:
My assumption is that since I'm providing the entire object getting created, that object is getting translated into the "raw" DynamoDB item, then getting written into the table(s). Can't ElectroDB return that item in the response? Not sure how this would look with update/patch/delete/etc.
Another thing I'm thinking about when writing this, it would be great to not have to loop through the results from a call like transaction.write, and instead have some way to label the items being written. Something like:
const{ data }=awaitMyService.transaction.write((entities)=>({person1: entities.person.create({id: "person-1", ... }).commit(),person2: entities.person.create({id: "person-2", ... }).commit(),person3: entities.person.create({id: "person-3", ... }).commit()// or, for a way to group related items being writtenpeople: [entities.person.create({id: "person-1", ... }).commit(),entities.person.create({id: "person-2", ... }).commit(),entities.person.create({id: "person-3", ... }).commit(),]})).go()// In the background, this does something like `Object.values` to transform each transact item// into the array that goes to the underlying transaction call, then after the transaction// finishes and the call is successful, the values are written back to the object that is// provided in the `transact.write` callback:// data.person* is typed as EntityItem<typeof Person>data.person1.id// "person-1"data.person2.id// "person-2"data.person3.id// "person-3"// or, for a way to group related items being written// data.people is typed as EntityItem<typeof Person>[]data.people[0].id// "person-1"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm making a write call in my application to create multiple items in multiple tables. I'm using a transact write for this, since BatchWrite AFAICT isn't supported on multiple entities. I'd love to get the item that was successfully created in the response from the transact write call:
My assumption is that since I'm providing the entire object getting created, that object is getting translated into the "raw" DynamoDB item, then getting written into the table(s). Can't ElectroDB return that item in the response? Not sure how this would look with update/patch/delete/etc.
Another thing I'm thinking about when writing this, it would be great to not have to loop through the results from a call like
transaction.write
, and instead have some way to label the items being written. Something like:Beta Was this translation helpful? Give feedback.
All reactions