// create a new query runner
const queryRunner = dataSource.createQueryRunner();
// establish real database connection using our new query runner
await queryRunner.connect();
// lets now open a new transaction:
await queryRunner.startTransaction();
try {
// execute some operations on this transaction:
const email = await userDao.getEmailById(id);
const result = await userdao.getCart(email);
// commit transaction now:
await queryRunner.commitTransaction();
} catch (err) {
// since we have errors let's rollback changes we made
await queryRunner.rollbackTransaction();
} finally {
// you need to release query runner which is manually created:
// await queryRunner.release();
// error : Query runner already released. Cannot run queries anymore.
// release를 쓰면 위의 에러가 난다...
}