Skip to content

loopback4-sequelize / Transaction / ISOLATION_LEVELS

Enumeration: ISOLATION_LEVELS

Transaction.ISOLATION_LEVELS

Isolations levels can be set per-transaction by passing options.isolationLevel to sequelize.transaction. Default to REPEATABLE_READ but you can override the default isolation level by passing options.isolationLevel in new Sequelize.

The possible isolations levels to use when starting a transaction:

{
  READ_UNCOMMITTED: "READ UNCOMMITTED",
  READ_COMMITTED: "READ COMMITTED",
  REPEATABLE_READ: "REPEATABLE READ",
  SERIALIZABLE: "SERIALIZABLE"
}

Pass in the desired level as the first argument:

try {
  await sequelize.transaction({isolationLevel: Sequelize.Transaction.SERIALIZABLE}, transaction => {
     // your transactions
  });
  // transaction has been committed. Do something after the commit if required.
} catch(err) {
  // do something with the err.
}

Table of contents

Enumeration Members

Enumeration Members

READ_COMMITTED

READ_COMMITTED = "READ COMMITTED"

Defined in

node_modules/sequelize/types/transaction.d.ts:74


READ_UNCOMMITTED

READ_UNCOMMITTED = "READ UNCOMMITTED"

Defined in

node_modules/sequelize/types/transaction.d.ts:73


REPEATABLE_READ

REPEATABLE_READ = "REPEATABLE READ"

Defined in

node_modules/sequelize/types/transaction.d.ts:75


SERIALIZABLE

SERIALIZABLE = "SERIALIZABLE"

Defined in

node_modules/sequelize/types/transaction.d.ts:76