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
dataset.runInTransaction(function(transaction,done){// From the `transaction` object, execute dataset methods as usual.// Call `done` when you're ready to commit all of the changes.transaction.get(dataset.key('Company',123),function(err,entity){if(err){transaction.rollback(done);return;}done();});},function(err){});
Any reason why done is separate from transaction?
Can we replace done with transaction.done?
Also, what does calling rollback with the done function do? Shouldn't it do this by default? It could if we can just call this.done() from within Transaction.prototype.rollback() ?
Any reason why done is separate from transaction?
Can we replace done with transaction.done?
It's common to see flow control callbacks come as their own variable. I'd like to stay with done.
Also, what does calling rollback with the done function do? Shouldn't it do this by default? It could if we can just call this.done() from within Transaction.prototype.rollback() ?
It could do it by default, but the user should understand the flow. "When rollback is done, this function is exiting. My callback to runInTransaction will be next."
Activity
stephenplusplus commentedon Sep 12, 2014
It's common to see flow control callbacks come as their own variable. I'd like to stay with
done.It could do it by default, but the user should understand the flow. "When rollback is done, this function is exiting. My callback to runInTransaction will be next."
ryanseys commentedon Sep 12, 2014
This makes sense. I'm closing this.
fix(deps): update dependency @google-cloud/storage to v4 (#207)
fix(docs): move to new client docs URL (#207)
fix(docs): move to new client docs URL (#207)
fix(docs): move to new client docs URL (#207)
fix(docs): move to new client docs URL (#207)
chore(deps): update dependency mocha to v6 (#207)
41 remaining items
feat: (observability): trace Database.runTransactionAsync (#2167)
chore(main): release 7.15.0 (#2118)
build: missing closing paren in publish script, delete template for N…
chore: release 1.0.3 (#207)
chore: ignore package-lock.json (#207)
chore(deps): update actions/setup-node action to v3 (#1393) (#207)
chore: update CODEOWNERS (#207)
chore: update CODEOWNERS (#207)
Release v0.21.1 (#207)
chore(main): release 3.0.0 (#207)
Delete data on row.js mutation calls (#207)
Delete data on row.js mutation calls (#207)
chore: ignore package-lock.json (#207)
Delete data on row.js mutation calls (#207)
Delete data on row.js mutation calls (googleapis#207)