mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-28 12:43:06 +08:00
Added Transaction Type access
This commit is contained in:
Vendored
+59
@@ -5176,6 +5176,14 @@ declare module "sequelize" {
|
||||
*/
|
||||
isolationLevel? : string;
|
||||
|
||||
/**
|
||||
* Set the default transaction type. See `Sequelize.Transaction.TRANSACTION_TYPES` for possible
|
||||
* options.
|
||||
*
|
||||
* Defaults to 'DEFERRED'
|
||||
*/
|
||||
transactionType? : string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5786,6 +5794,41 @@ declare module "sequelize" {
|
||||
*/
|
||||
ISOLATION_LEVELS : TransactionIsolationLevels;
|
||||
|
||||
/**
|
||||
* Transaction type can be set per-transaction by passing `options.type` to
|
||||
* `sequelize.transaction`. Default to `DEFERRED` but you can override the default isolation level
|
||||
* by passing `options.transactionType` in `new Sequelize`.
|
||||
*
|
||||
* The transaction types to use when starting a transaction:
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* DEFERRED: "DEFERRED",
|
||||
* IMMEDIATE: "IMMEDIATE",
|
||||
* EXCLUSIVE: "EXCLUSIVE"
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Pass in the transaction type the first argument:
|
||||
*
|
||||
* ```js
|
||||
* return sequelize.transaction({
|
||||
* type: Sequelize.Transaction.EXCLUSIVE
|
||||
* }, function (t) {
|
||||
*
|
||||
* // your transactions
|
||||
*
|
||||
* }).then(function(result) {
|
||||
* // transaction has been committed. Do something after the commit if required.
|
||||
* }).catch(function(err) {
|
||||
* // do something with the err.
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @see TRANSACTION_TYPES
|
||||
*/
|
||||
TRANSACTION_TYPES : TransactionTypes;
|
||||
|
||||
/**
|
||||
* Possible options for row locking. Used in conjuction with `find` calls:
|
||||
*
|
||||
@@ -5837,6 +5880,17 @@ declare module "sequelize" {
|
||||
SERIALIZABLE: string; // 'SERIALIZABLE'
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction type can be set per-transaction by passing `options.type` to `sequelize.transaction`.
|
||||
* Default to `DEFERRED` but you can override the default isolation level by passing
|
||||
* `options.transactionType` in `new Sequelize`.
|
||||
*/
|
||||
interface TransactionTypes {
|
||||
DEFERRED: string; // 'DEFERRED'
|
||||
IMMEDIATE: string; // 'IMMEDIATE'
|
||||
EXCLUSIVE: string; // 'EXCLUSIVE'
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible options for row locking. Used in conjuction with `find` calls:
|
||||
*/
|
||||
@@ -5861,6 +5915,11 @@ declare module "sequelize" {
|
||||
*/
|
||||
isolationLevel?: string;
|
||||
|
||||
/**
|
||||
* See `Sequelize.Transaction.TRANSACTION_TYPES` for possible options
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* A function that gets executed while running the query to log the sql.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user