prorm API Reference
    Preparing search index...

    Type Alias LockOptions

    LockOptions:
        | LockType
        | boolean
        | { of: ModelStatic<any> }
        | {
            level?: LockType;
            nowait?: boolean;
            skipLocked?: boolean;
            of?: ModelStatic<any>;
        }

    Lock options for row-level locking

    // Lock all rows with FOR UPDATE
    User.findAll({ lock: 'UPDATE' })

    // Lock with transaction-level FOR UPDATE
    User.findAll({ lock: true, transaction: t })

    // Lock only the User table (PostgreSQL)
    User.findAll({ lock: { of: User } })

    // NOWAIT - return error if lock not available (PostgreSQL/MySQL 8.0+)
    User.findAll({ lock: { level: 'UPDATE', nowait: true } })

    // SKIP LOCKED - skip locked rows (PostgreSQL/MySQL 8.0+)
    User.findAll({ lock: { level: 'UPDATE', skipLocked: true } })

    // Modifiers on their own imply FOR UPDATE
    User.findAll({ lock: { skipLocked: true } })

    nowait and skipLocked are mutually exclusive - setting both throws. Dialects with no row-level locking (SQLite and friends) ignore lock entirely; dialects that have locking but cannot express the exact request (e.g. SHARE on Oracle, SKIP LOCKED on Db2) throw when the query is built.