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

Commit 80414a1c by Jan Aagaard Meier

[ci skip] Add return statements to CLS examples

1 parent 50beb169
Showing with 3 additions and 1 deletions
...@@ -80,7 +80,7 @@ In most case you won't need to access `namespace.get('transaction')` directly, s ...@@ -80,7 +80,7 @@ In most case you won't need to access `namespace.get('transaction')` directly, s
```js ```js
sequelize.transaction(function (t1) { sequelize.transaction(function (t1) {
// With CLS enabled, the user will be created inside the transaction // With CLS enabled, the user will be created inside the transaction
User.create({ name: 'Alice' }); return User.create({ name: 'Alice' });
}); });
``` ```
...@@ -90,8 +90,10 @@ If you want to execute queries inside the callback without using the transaction ...@@ -90,8 +90,10 @@ If you want to execute queries inside the callback without using the transaction
sequelize.transaction(function (t1) { sequelize.transaction(function (t1) {
sequelize.transaction(function (t2) { sequelize.transaction(function (t2) {
// By default queries here will use t2 // By default queries here will use t2
return Promise.all([
User.create({ name: 'Bob' }, { transaction: null }); User.create({ name: 'Bob' }, { transaction: null });
User.create({ name: 'Mallory' }, { transaction: t1 }); User.create({ name: 'Mallory' }, { transaction: t1 });
]);
}); });
}); });
``` ```
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!