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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more