psr7-demo
psr7-demo copied to clipboard
Transactions support
Do you plan on adding transaction support at any point in the future? Or do you recommend just using firebase references directly for this?
At the moment I'd recommend dropping down to raw firebase references, but would certainly be open to suggestions on how this would look if it was built in.
This is just off the top of my head, and I'm not sure if this would cover every use case, but what about something like this:
record.transaction('attrName', function(currentValue) {
return (currentValue || 0) + 1;
});
Where the first parameter attrName
is the name of the property that you want to atomically update on the given record, and the second parameter is the update function. Just like save()
and delete()
, transaction()
would also return a promise.