pub trait Connection {
type Exec<'c>: Executor<'c, Database = Any>
where Self: 'c;
// Required method
fn executor<'c>(&'c mut self) -> Self::Exec<'c>;
}Expand description
A trait representing a database connection or transaction.
This trait abstracts over Database (pool) and Transaction types, allowing
the QueryBuilder to work seamlessly with both. It uses Generic Associated Types (GATs)
to handle the lifetimes of the executor references correctly.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'a> Connection for &mut Transaction<'a, Any>
Implementation of Connection for a mutable reference to sqlx::Transaction.
impl<'a> Connection for &mut Transaction<'a, Any>
Implementation of Connection for a mutable reference to sqlx::Transaction.
Implementors§
Source§impl Connection for Database
Implementation of Connection for the main Database struct.
impl Connection for Database
Implementation of Connection for the main Database struct.
Uses the internal connection pool to execute queries.
Source§impl<'a> Connection for &'a mut Database
Implementation of Connection for a mutable reference to Database.
impl<'a> Connection for &'a mut Database
Implementation of Connection for a mutable reference to Database.
Source§impl<'a> Connection for bottle_orm::transaction::Transaction<'a>
Implementation of Connection for a Transaction.
impl<'a> Connection for bottle_orm::transaction::Transaction<'a>
Implementation of Connection for a Transaction.
Allows the QueryBuilder to use a transaction for executing queries.
Supports generic borrow lifetimes to allow multiple operations within
the same transaction scope.
type Exec<'c> = &'c mut AnyConnection where Self: 'c
Source§impl<'a, 'b> Connection for &'a mut bottle_orm::transaction::Transaction<'b>
Implementation of Connection for a mutable reference to Transaction.
impl<'a, 'b> Connection for &'a mut bottle_orm::transaction::Transaction<'b>
Implementation of Connection for a mutable reference to Transaction.