【发布时间】:2021-08-17 18:12:38
【问题描述】:
我将 typeorm 与 nestjs 一起使用。 但我不知道如何使用方法来使用事务
例如,
async createTrack(track) {
try {
const createdTrack = await this.createTrack(track);
//this.boardService.createBoard will work by transaction.
const board = await this.boardService.createBoard({
...track.board
});
return board;
} catch (e) {
throw e;
}
我想使用boardSerivce的方法进行交易。
怎么办?
我解决了。
试试看。 TypeORM transaction with query builder
或
使用https://github.com/odavid/typeorm-transactional-cls-hooked
【问题讨论】:
标签: transactions nestjs typeorm