runWithTransaction
Function: runWithTransaction()
runWithTransaction<
T>(fn,participants?,context?):Promise<T>
Defined in: packages/core/src/core/transactions.ts:242
Run a function in a transaction, for code outside operations (CLI, queue workers, tests)
Inside an active transaction, the participants are enlisted in it and the function joins it: the work is committed with the outer transaction. Otherwise a transaction is begun, committed when the function resolves and rolled back when it throws.
Type Parameters
T
T
Parameters
fn
() => Promise<T>
the function
participants?
OperationTransactionParticipant[] = ...
the participants, every registered one by default
context?
Context = ...
the execution context handed to the participants
Returns
Promise<T>
the function result