pub struct TenantIsolation {
pub field: &'static str,
}Expand description
租户隔离规则 — 自动追加 tenant_id = ? 条件
对应 MyBatis-Plus TenantLineHandler / Hibernate @TenantId。
§示例
use sz_orm_core::data_permission::{TenantIsolation, PermissionRule, PermissionContext};
let rule = TenantIsolation::new("tenant_id");
let ctx = PermissionContext::new().with_tenant_id(5);
let clause = rule.apply(&ctx).unwrap().unwrap();
assert_eq!(clause, "tenant_id = 5");Fields§
§field: &'static str租户字段名(默认 “tenant_id”)
Implementations§
Source§impl TenantIsolation
impl TenantIsolation
Sourcepub fn default_field() -> Self
pub fn default_field() -> Self
使用默认字段名 “tenant_id”
Trait Implementations§
Source§impl PermissionRule for TenantIsolation
impl PermissionRule for TenantIsolation
Auto Trait Implementations§
impl Freeze for TenantIsolation
impl RefUnwindSafe for TenantIsolation
impl Send for TenantIsolation
impl Sync for TenantIsolation
impl Unpin for TenantIsolation
impl UnsafeUnpin for TenantIsolation
impl UnwindSafe for TenantIsolation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more