Skip to main content

bind_tenant

Function bind_tenant 

Source
pub async fn bind_tenant<'c>(
    transaction: &mut Transaction<'c, Postgres>,
    tenant_id: &TenantId,
) -> Result<(), Error>
Expand description

Binds a validated tenant to the current transaction for the RLS profile.

The setting is transaction-local and cannot outlive the supplied SQLx transaction. It does not replace the adapter’s tenant predicates.

§Errors

Returns the database error if binding transaction-local tenant context fails. The caller must roll back the transaction before retrying.