Skip to main content

TenantContext

Trait TenantContext 

Source
pub trait TenantContext: EntityPolicy {
    const COLUMN_NAME: &'static str;

    // Required method
    fn tenant_value(&self) -> SqlValue;
}
Expand description

Runtime value shape for the active tenant configured on a context.

#[derive(TenantContext)] implements this trait for user-defined structs with exactly one field. The field defines both the tenant column name and the SQL value used by tenant-scoped reads and writes.

Required Associated Constants§

Source

const COLUMN_NAME: &'static str

Physical column name used by tenant-scoped entities.

Required Methods§

Source

fn tenant_value(&self) -> SqlValue

Converts the active tenant value into the SQL value compared in queries.

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§