(trx: DbTransaction, tableId: string)
| 50 | * restores per-table serialization. Released at COMMIT/ROLLBACK. |
| 51 | */ |
| 52 | export async function acquireRowOrderLock(trx: DbTransaction, tableId: string) { |
| 53 | await trx.execute( |
| 54 | sql`SELECT pg_advisory_xact_lock(hashtextextended(${`user_table_rows_pos:${tableId}`}, 0))` |
| 55 | ) |
| 56 | } |
| 57 | |
| 58 | /** Next append position for a table (max(position) + 1, or 0 if empty). */ |
| 59 | export async function nextRowPosition(trx: DbTransaction, tableId: string): Promise<number> { |
no test coverage detected