Skip to content

Function: withAdvisoryTransactionLock()

withAdvisoryTransactionLock<T>(pool, key, fn): Promise<T>

Run fn in a transaction while holding a transaction advisory lock.

The lock is released atomically by COMMIT or ROLLBACK, making this the right primitive for one-time schema installation and migrations.

T

PgPoolLike

unknown

(client) => T | Promise<T>

Promise<T>