Skip to main content

TenantModel

Trait TenantModel 

Source
pub trait TenantModel: Model {
    // Required methods
    fn tenant_id(&self) -> i64;
    fn set_tenant_id(&mut self, tenant_id: i64);

    // Provided method
    fn tenant_field() -> &'static str { ... }
}
Expand description

多租户 Model trait

实现此 trait 的 Model 自动获得 TenantScope 全局作用域。

Required Methods§

Source

fn tenant_id(&self) -> i64

获取当前行的租户 ID

Source

fn set_tenant_id(&mut self, tenant_id: i64)

设置租户 ID

Provided Methods§

Source

fn tenant_field() -> &'static str

租户字段名(默认 tenant_id

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§