ParentLock.table
property · packages/remote-drizzle/src/parentLock.ts:29
readonly table: PgTableThe Postgres parent table whose rows are locked with SELECT ... FOR UPDATE.
Remote / foldkit-remote-drizzle
interface · packages/remote-drizzle/src/parentLock.ts:27
interface ParentLock<Field extends string = string> {
readonly table: PgTable
readonly id: PgColumn
readonly by: ReadonlyArray<Field>
readonly onWrite?: (context: {
readonly parentIds: ReadonlyArray<string>
readonly tx: ParentLockTransaction
}) => PromiseLike<void> | void
}Options for locking parent rows on Postgres during child writes.
ParentLock.tableproperty · packages/remote-drizzle/src/parentLock.ts:29
readonly table: PgTableThe Postgres parent table whose rows are locked with SELECT ... FOR UPDATE.
ParentLock.idproperty · packages/remote-drizzle/src/parentLock.ts:31
readonly id: PgColumnThe parent table's primary key column.
ParentLock.byproperty · packages/remote-drizzle/src/parentLock.ts:33
readonly by: ReadonlyArray<Field>Foreign-key or link field names on the child entity that identify parent row ids.
ParentLock.onWriteproperty · packages/remote-drizzle/src/parentLock.ts:38
readonly onWrite?: (context: {
readonly parentIds: ReadonlyArray<string>
readonly tx: ParentLockTransaction
}) => PromiseLike<void> | voidOptional hook run inside the same transaction after locking the parent rows and writing the child, e.g. to update a stored aggregate total on the parent.