【发布时间】:2018-12-20 20:46:18
【问题描述】:
user.setShooter 会在这里做什么?
return sequelize.transaction(function (t) {
// chain all your queries here. make sure you return them. <br>
return User.create({<br>
firstName: 'Abraham',<br>
lastName: 'Lincoln'<br>
}, {transaction: t}).then(function (user) {<br>
return user.setShooter({<br>
firstName: 'John',<br>
lastName: 'Boothe'<br>
}, {transaction: t});<br>
});<br>
<br>
}).then(function (result) {<br>
// Transaction has been committed<br>
// result is whatever the result of the promise chain returned to the transaction callback<br>
}).catch(function (err) {<br>
// Transaction has been rolled back<br>
// err is whatever rejected the promise chain returned to the transaction callback<br>
});<br>
【问题讨论】:
标签: node.js transactions sequelize.js