Skip to main content

Executor

Trait Executor 

Source
pub trait Executor: Sealed {
    // Required methods
    fn query_raw(
        &self,
        sql: &str,
        params: &[&(dyn ToSql + Sync)],
    ) -> impl Future<Output = BsqlResult<Arc<Vec<Row>>>> + Send;
    fn query_raw_readonly(
        &self,
        sql: &str,
        params: &[&(dyn ToSql + Sync)],
    ) -> impl Future<Output = BsqlResult<Arc<Vec<Row>>>> + Send;
    fn execute_raw(
        &self,
        sql: &str,
        params: &[&(dyn ToSql + Sync)],
    ) -> impl Future<Output = BsqlResult<u64>> + Send;
}
Expand description

Execute a prepared query and return raw rows.

This trait is sealed – it cannot be implemented outside of bsql-core. The generated code calls query_raw, query_raw_readonly, and execute_raw on &Pool, &PoolConnection, or &Transaction.

Required Methods§

Source

fn query_raw( &self, sql: &str, params: &[&(dyn ToSql + Sync)], ) -> impl Future<Output = BsqlResult<Arc<Vec<Row>>>> + Send

Execute a query and return all rows (shared via Arc for singleflight).

Source

fn query_raw_readonly( &self, sql: &str, params: &[&(dyn ToSql + Sync)], ) -> impl Future<Output = BsqlResult<Arc<Vec<Row>>>> + Send

Execute a read-only query. Routes to replicas when available.

For Pool: routes to replica pool if replicas are configured, otherwise falls through to primary. For PoolConnection/Transaction: identical to query_raw (connection is already bound).

Source

fn execute_raw( &self, sql: &str, params: &[&(dyn ToSql + Sync)], ) -> impl Future<Output = BsqlResult<u64>> + Send

Execute a query and return the number of affected rows.

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§