Skip to main content

execute_scoped

Function execute_scoped 

Source
pub async fn execute_scoped<'q>(
    pool: &PgPool,
    query: Query<'q, Postgres, PgArguments>,
) -> Result<PgQueryResult, Error>
Expand description

Tenant-agnostic execute for hand-written module SQL (ADR-0029): ride the request-dedicated connection when one is bound — carrying whatever fence variables the COMPOSING service’s scope set (with_org_request_scope / with_request_scope) — otherwise execute plainly on the pool.

Unlike execute_unit_scoped this invents no scope of its own: a module that knows nothing about tenancy must not fabricate a unit or a company. Under a composer’s request scope the database fence owns isolation; with no scope bound this is a plain unfenced execute.