pub trait Connection {
type Exec<'c>: Executor<'c, Database = Any>
where Self: 'c;
// Required methods
fn executor<'c>(&'c mut self) -> Self::Exec<'c>;
fn driver(&self) -> Drivers;
}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.
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 &mut Transaction<'a>
Implementation of Connection for a mutable reference to a Transaction.
impl<'a> Connection for &mut Transaction<'a>
Implementation of Connection for a mutable reference to 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.