macro_rules! start_transaction {
() => { ... };
}Expand description
Begins a new transaction on the global pool.
On failure the error is logged with tracing and returned, so the calling
function must return a Result<_, sqlx::Error>.
ยงExample
use zirv_db_sqlx::{start_transaction, commit_transaction};
async fn perform_db_operations() -> Result<(), sqlx::Error> {
let mut tx = start_transaction!();
// Execute operations within the transaction...
commit_transaction!(tx);
Ok(())
}