Skip to main content

with_transaction

Function with_transaction 

Source
pub async fn with_transaction<C, F, T, E>(db: &C, operation: F) -> Result<T, E>
where C: TransactionTrait, F: for<'txn> AsyncFnOnce(&'txn C::Transaction) -> Result<T, E>, E: From<DbError> + Display,
Expand description

Runs a transaction callback with consistent tracing and rollback guarding.

The callback may return a product-specific error type. Forge-created transaction boundary errors are converted through E: From<DbError>, while callback errors are preserved unchanged.