pub struct Policy {
pub name: String,
pub table: String,
pub schema: Option<String>,
pub command: PolicyCommand,
pub role: Option<String>,
pub expression: String,
pub check_expression: Option<String>,
pub permissive: bool,
}Expand description
PostgreSQL Row-Level Security Policy
Fields§
§name: String§table: String§schema: Option<String>§command: PolicyCommand§role: Option<String>§expression: String§check_expression: Option<String>§permissive: boolImplementations§
Source§impl Policy
impl Policy
Sourcepub fn new(
name: impl Into<String>,
table: impl Into<String>,
command: PolicyCommand,
expression: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, table: impl Into<String>, command: PolicyCommand, expression: impl Into<String>, ) -> Self
Create a new policy
Sourcepub fn with_check(self, expression: impl Into<String>) -> Self
pub fn with_check(self, expression: impl Into<String>) -> Self
Set the WITH CHECK expression
Sourcepub fn restrictive(self) -> Self
pub fn restrictive(self) -> Self
Set policy as restrictive (default is permissive)
Sourcepub fn permissive(self) -> Self
pub fn permissive(self) -> Self
Set policy as permissive (default)
Sourcepub fn to_drop_sql(&self) -> String
pub fn to_drop_sql(&self) -> String
Convert policy to DROP SQL
Trait Implementations§
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policy
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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