It would probably be neat to be able to do something like:
yield db.transaction(function *(t) {
yield user.create({}, {transaction: t});
yield account.create({}, {transaction: t});
});
// or with CLS:
yield db.transaction(function *() {
yield user.create({});
yield account.create({});
});
How do you handle transactions and generators/co currently @fixe?
Whats blocking this currently?
@janmeier Well we don't support generators, maybe it works if you wrap it in co though, not sure :)
yield db.transaction(function (t) {
return co(function * () {
seems to achieve this so closing.
Most helpful comment
seems to achieve this so closing.