Skip to content

withTransaction

withTransaction<T>(conn, body): Promise<T>

Defined in: db/store.ts:155

Run body inside a DuckDB transaction, committing on success and rolling back on failure. The rejection is re-thrown after the rollback so callers can retry the whole unit of work: because nothing was committed, a retry cannot duplicate the rows a partially-applied batch loop would have left behind.

DuckDB has no nested transactions, so callers must not overlap two withTransaction calls on the same connection.

T

AsyncDuckDBConnection

() => Promise<T>

Promise<T>