Skip to main content

transaction_with_isolation

Function transaction_with_isolation 

Source
pub async fn transaction_with_isolation<'a, T, F, Fut>(
    pool: &PgPool,
    isolation_level: IsolationLevel,
    f: F,
) -> TransactionResult<T>
where F: FnOnce(&mut Transaction) -> Fut, Fut: Future<Output = Result<T, TransactionError>> + 'a,
Expand description

Execute a function within a transaction with a specific isolation level

§Arguments

  • pool - The database connection pool
  • isolation_level - The isolation level for the transaction
  • f - The async function to execute within the transaction

§Returns

The result of the function, or a transaction error