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§
Sourcefn set_tenant_id(&mut self, tenant_id: i64)
fn set_tenant_id(&mut self, tenant_id: i64)
设置租户 ID
Provided Methods§
Sourcefn tenant_field() -> &'static str
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".