不要怂,就是干,撸起袖子干!

Commit aab71d68 by Markus Hedlund

Clarify that transaction.commit() and rollback() returns a promise

1 parent d2fc3923
Showing with 3 additions and 3 deletions
......@@ -133,7 +133,7 @@ return sequelize.transaction({
```
# Unmanaged transaction (then-callback)
Unmanaged transactions force you to manually rollback or commit the transaction. If you don't do that, the transaction will hang until it times out. To start an unmanaged transaction, call `sequelize.transaction()` without a callback (you can still pass an options object) and call `then` on the returned promise.
Unmanaged transactions force you to manually rollback or commit the transaction. If you don't do that, the transaction will hang until it times out. To start an unmanaged transaction, call `sequelize.transaction()` without a callback (you can still pass an options object) and call `then` on the returned promise. Notice that `commit()` and `rollback()` returns a promise.
```js
return sequelize.transaction().then(function (t) {
......@@ -146,9 +146,9 @@ return sequelize.transaction().then(function (t) {
lastName: 'Simpson'
}, {transaction: t});
}).then(function () {
t.commit();
return t.commit();
}).catch(function (err) {
t.rollback();
return t.rollback();
});
});
```
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!