macro_rules! rollback_transaction {
($tx:expr) => { ... };
}Expand description
Macro to rollback an active transaction.
This macro takes a transaction handle as an argument and rolls back the transaction. If the rollback fails, it logs the error and returns it.
ยงExample
use zirv_db_sqlx::{rollback_transaction, start_transaction};
async fn perform_db_operations() -> Result<(), sqlx::Error> {
let mut tx = start_transaction!();
// Execute operations within the transaction...
rollback_transaction!(tx);
Ok(())
}