Sequelize: Better generator/co support in transactions

Created on 8 Apr 2015  路  3Comments  路  Source: sequelize/sequelize

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?

feature

Most helpful comment

yield db.transaction(function (t) {
    return co(function * () {

seems to achieve this so closing.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mujz picture mujz  路  3Comments

mwain picture mwain  路  3Comments

dylanpyle picture dylanpyle  路  3Comments

kasparsklavins picture kasparsklavins  路  3Comments

ryanwalters picture ryanwalters  路  3Comments