loopback4-sequelize / Transaction
Class: Transaction
The transaction object is used to identify a running transaction. It is created by calling
Sequelize.transaction()
.
To run a query under a transaction, you should pass the transaction in the options object.
Table of contents
Constructors
Accessors
Methods
Constructors
constructor
• new Transaction(sequelize
, options
)
Parameters
Name | Type |
---|---|
sequelize |
Sequelize |
options |
TransactionOptions |
Defined in
node_modules/sequelize/types/transaction.d.ts:12
Accessors
LOCK
• get
LOCK(): LOCK
Same as its static version, but can also be called on instances of transactions to get possible options for row locking directly from the instance.
Returns
LOCK
Defined in
node_modules/sequelize/types/transaction.d.ts:39
LOCK
• Static
get
LOCK(): LOCK
Returns possible options for row locking
Returns
LOCK
Defined in
node_modules/sequelize/types/transaction.d.ts:32
Methods
afterCommit
▸ afterCommit(fn
): void
Adds hook that is run after a transaction is committed
Parameters
Name | Type |
---|---|
fn |
(transaction : Transaction ) => void | Promise <void > |
Returns
void
Defined in
node_modules/sequelize/types/transaction.d.ts:27
commit
▸ commit(): Promise
<void
>
Commit the transaction
Returns
Promise
<void
>
Defined in
node_modules/sequelize/types/transaction.d.ts:17
rollback
▸ rollback(): Promise
<void
>
Rollback (abort) the transaction
Returns
Promise
<void
>
Defined in
node_modules/sequelize/types/transaction.d.ts:22