Skip to main content

raw_query_pool

Function raw_query_pool 

Source
pub async fn raw_query_pool<T>(
    sql: &str,
    binds: Vec<SqlValue>,
    pool: &Pool,
) -> Result<Vec<T>, ExecError>
where T: for<'r> FromRow<'r, PgRow> + MaybeMyFromRow + Send + Unpin,
Expand description

Execute arbitrary SQL with bound SqlValue params and decode each row into T via FromRow. Bi-dialect counterpart of raw_query.

SQL must use the dialect’s placeholder shape ($1 for Postgres, ? for MySQL) — read it from pool.dialect().placeholder(n) when constructing dynamic queries. Apps writing literal SQL pick the right shape themselves.

§Errors

As raw_query.