prorm API Reference
    Preparing search index...

    Interface TransactionOptions

    Options for a transaction: isolation level, type, and whether it nests as a savepoint inside an outer transaction.

    interface TransactionOptions {
        autocommit?: boolean;
        isolationLevel?: IsolationLevel | IsolationLevelString;
        type?: "IMMEDIATE" | "DEFERRED" | "EXCLUSIVE";
        deferrable?: string;
        lock?: LockOptions;
    }
    Index
    autocommit?: boolean

    ANSI SQL transaction isolation level. Accepts either the IsolationLevel enum or the equivalent raw string literal (kept for backwards compatibility with existing callers). Dialect-specific native values that aren't part of the ANSI set (e.g. Db2's UR/CS/RS/RR abbreviations or MSSQL's SNAPSHOT) are intentionally not part of the IsolationLevel enum and continue to be accepted only as plain strings by the dialects that support them.

    { isolationLevel: 'SERIALIZABLE' }
    
    { isolationLevel: IsolationLevel.Serializable }
    
    type?: "IMMEDIATE" | "DEFERRED" | "EXCLUSIVE"
    deferrable?: string

    Lock level for all queries within the transaction

    • true: FOR UPDATE (equivalent to 'UPDATE')
    • 'UPDATE': FOR UPDATE
    • 'SHARE': FOR SHARE (PostgreSQL) / LOCK IN SHARE MODE (MySQL)
    • 'KEY SHARE': FOR KEY SHARE (PostgreSQL only)
    • { of: Model }: Lock only the specified table (PostgreSQL)