mirror of
https://github.com/strapi/strapi.git
synced 2025-09-03 05:39:36 +00:00
feat: add inTransaction method
This commit is contained in:
parent
bdb92a93a4
commit
c29930f282
@ -51,6 +51,10 @@ class Database {
|
||||
return this.entityManager.getRepository(uid);
|
||||
}
|
||||
|
||||
inTransaction() {
|
||||
return !!transactionCtx.get();
|
||||
}
|
||||
|
||||
async transaction(cb) {
|
||||
const notNestedTransaction = !transactionCtx.get();
|
||||
const trx = notNestedTransaction ? await this.connection.transaction() : transactionCtx.get();
|
||||
|
Loading…
x
Reference in New Issue
Block a user