pub struct PoolConnection { /* private fields */ }Expand description
A connection borrowed from the pool.
Uses tokio::sync::Mutex for interior mutability because the driver’s
Connection requires &mut self for queries, but the Executor trait
takes &self. The mutex is uncontended in practice — a single connection
is used by one task at a time, never shared between concurrent tasks.
tokio::sync::Mutex is needed (over RefCell) because the future holding
the guard must be Send for tokio task migration between worker threads.
Returned to the pool when dropped.
Trait Implementations§
Source§impl Debug for PoolConnection
impl Debug for PoolConnection
Source§impl Executor for PoolConnection
impl Executor for PoolConnection
Source§async fn query_raw(
&self,
sql: &str,
sql_hash: u64,
params: &[&(dyn Encode + Sync)],
) -> BsqlResult<OwnedResult>
async fn query_raw( &self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<OwnedResult>
Execute a query and return all rows.
Source§async fn query_raw_readonly(
&self,
sql: &str,
sql_hash: u64,
params: &[&(dyn Encode + Sync)],
) -> BsqlResult<OwnedResult>
async fn query_raw_readonly( &self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<OwnedResult>
Execute a read-only query. May route to replicas in the future.
Source§async fn execute_raw(
&self,
sql: &str,
sql_hash: u64,
params: &[&(dyn Encode + Sync)],
) -> BsqlResult<u64>
async fn execute_raw( &self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<u64>
Execute a query and return the number of affected rows.
Auto Trait Implementations§
impl !Freeze for PoolConnection
impl !RefUnwindSafe for PoolConnection
impl Send for PoolConnection
impl Sync for PoolConnection
impl Unpin for PoolConnection
impl UnsafeUnpin for PoolConnection
impl UnwindSafe for PoolConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more