Macro commit_transaction

Source
macro_rules! commit_transaction {
    ($tx:expr) => { ... };
}
Expand description

Macro to commit an active transaction.

This macro takes a transaction handle as an argument and commits the transaction. If the commit fails, it logs the error and returns it.

ยงExample

use zirv_db_sqlx::{commit_transaction, start_transaction};
 
async fn perform_db_operations() -> Result<(), sqlx::Error> {
   let mut tx = start_transaction!();
   // Execute operations within the transaction...
   commit_transaction!(tx);
   Ok(())
}