Decorator to apply row lock to a method. Provides options for locking rows during query execution.
Usage:
@WithLock({ mode: 'UPDATE', timeout: 5000, skipLocked: true }) async processOrder(id: number) { const order = await Order.findByPk(id, { lock: 'UPDATE' }); // process order } Copy
@WithLock({ mode: 'UPDATE', timeout: 5000, skipLocked: true }) async processOrder(id: number) { const order = await Order.findByPk(id, { lock: 'UPDATE' }); // process order }
Lock options
Decorator to apply row lock to a method. Provides options for locking rows during query execution.
Usage: