pub struct RowLevelSecurity { /* private fields */ }Expand description
行级权限构建器
Implementations§
Source§impl RowLevelSecurity
impl RowLevelSecurity
pub fn new(context: AccessContext) -> Self
Sourcepub fn tenant_isolation(self, table: &str, tenant_column: &str) -> Self
pub fn tenant_isolation(self, table: &str, tenant_column: &str) -> Self
为表添加租户隔离规则
§安全
table会校验为合法 SQL 标识符(防注入)tenant_column会校验为合法 SQL 标识符(防注入)tenant_id会转义单引号与反斜杠(防注入)
Sourcepub fn user_isolation(self, table: &str, user_column: &str) -> Self
pub fn user_isolation(self, table: &str, user_column: &str) -> Self
Sourcepub fn deny_columns(self, table: &str, columns: &[&str]) -> Self
pub fn deny_columns(self, table: &str, columns: &[&str]) -> Self
禁止查询敏感字段
pub fn build(self) -> AccessContext
Auto Trait Implementations§
impl Freeze for RowLevelSecurity
impl RefUnwindSafe for RowLevelSecurity
impl Send for RowLevelSecurity
impl Sync for RowLevelSecurity
impl Unpin for RowLevelSecurity
impl UnsafeUnpin for RowLevelSecurity
impl UnwindSafe for RowLevelSecurity
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