mirror of
https://github.com/strapi/strapi.git
synced 2025-09-05 22:57:56 +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);
|
return this.entityManager.getRepository(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inTransaction() {
|
||||||
|
return !!transactionCtx.get();
|
||||||
|
}
|
||||||
|
|
||||||
async transaction(cb) {
|
async transaction(cb) {
|
||||||
const notNestedTransaction = !transactionCtx.get();
|
const notNestedTransaction = !transactionCtx.get();
|
||||||
const trx = notNestedTransaction ? await this.connection.transaction() : transactionCtx.get();
|
const trx = notNestedTransaction ? await this.connection.transaction() : transactionCtx.get();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user