pub enum QueryTarget<'a> {
Pool(&'a Pool),
Conn(&'a mut PoolConnection),
Tx(&'a mut Transaction),
}Expand description
Concrete enum for query dispatch. Replaces the Executor trait.
Generated code converts the user-supplied executor (&Pool,
&mut PoolConnection, or &mut Transaction) into QueryTarget via
Into, then calls query_raw / query_raw_readonly / execute_raw.
Pool takes a shared reference (&Pool) because it acquires from the
pool internally. PoolConnection and Transaction take exclusive
references (&mut) — no Mutex needed.
Variants§
Implementations§
Source§impl<'a> QueryTarget<'a>
impl<'a> QueryTarget<'a>
Sourcepub fn query_raw(
self,
sql: &str,
sql_hash: u64,
params: &[&(dyn Encode + Sync)],
) -> BsqlResult<OwnedResult>
pub fn query_raw( self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<OwnedResult>
Execute a query and return all rows.
Sourcepub fn query_raw_readonly(
self,
sql: &str,
sql_hash: u64,
params: &[&(dyn Encode + Sync)],
) -> BsqlResult<OwnedResult>
pub fn query_raw_readonly( self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<OwnedResult>
Execute a read-only query. Routes to replicas for Pool when configured.
Sourcepub fn execute_raw(
self,
sql: &str,
sql_hash: u64,
params: &[&(dyn Encode + Sync)],
) -> BsqlResult<u64>
pub 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.
Trait Implementations§
Source§impl<'a> From<&'a Pool> for QueryTarget<'a>
impl<'a> From<&'a Pool> for QueryTarget<'a>
Source§impl<'a> From<&'a mut PoolConnection> for QueryTarget<'a>
impl<'a> From<&'a mut PoolConnection> for QueryTarget<'a>
Source§fn from(conn: &'a mut PoolConnection) -> Self
fn from(conn: &'a mut PoolConnection) -> Self
Converts to this type from the input type.
Source§impl<'a> From<&'a mut Transaction> for QueryTarget<'a>
impl<'a> From<&'a mut Transaction> for QueryTarget<'a>
Source§fn from(tx: &'a mut Transaction) -> Self
fn from(tx: &'a mut Transaction) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> Freeze for QueryTarget<'a>
impl<'a> RefUnwindSafe for QueryTarget<'a>
impl<'a> Send for QueryTarget<'a>
impl<'a> Sync for QueryTarget<'a>
impl<'a> Unpin for QueryTarget<'a>
impl<'a> UnsafeUnpin for QueryTarget<'a>
impl<'a> !UnwindSafe for QueryTarget<'a>
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