Expand description
§Transaction Module
This module provides the transaction management functionality for Bottle ORM. It allows executing multiple database operations atomically, ensuring data consistency.
§Features
- Atomic Operations: Group multiple queries into a single unit of work
- Automatic Rollback: Transactions are automatically rolled back if dropped without commit
- Driver Agnostic: Works consistently across PostgreSQL, MySQL, and SQLite
- Fluent API: Integrated with
QueryBuilderfor seamless usage
§Example Usage
ⓘ
use bottle_orm::Database;
let mut tx = db.begin().await?;
// Operations within transaction
tx.model::<User>().insert(&user).await?;
tx.model::<Post>().insert(&post).await?;
// Commit changes
tx.commit().await?;Structs§
- Transaction
- A wrapper around a SQLx transaction.