pub struct PolicyDef {
pub schema: &'static str,
pub table: &'static str,
pub name: &'static str,
pub as_clause: Option<&'static str>,
pub for_clause: Option<&'static str>,
pub to: Option<&'static [&'static str]>,
pub using: Option<&'static str>,
pub with_check: Option<&'static str>,
}Expand description
Const-friendly policy definition for compile-time schema definitions.
Fields§
§schema: &'static strSchema name
table: &'static strTable name
name: &'static strPolicy name
as_clause: Option<&'static str>AS clause (PERMISSIVE/RESTRICTIVE)
for_clause: Option<&'static str>FOR clause (ALL/SELECT/INSERT/UPDATE/DELETE)
to: Option<&'static [&'static str]>TO roles (comma-separated)
using: Option<&'static str>USING expression
with_check: Option<&'static str>WITH CHECK expression
Implementations§
Source§impl PolicyDef
impl PolicyDef
Sourcepub const fn new(
schema: &'static str,
table: &'static str,
name: &'static str,
) -> Self
pub const fn new( schema: &'static str, table: &'static str, name: &'static str, ) -> Self
Create a new policy definition
Sourcepub const fn for_clause(self, clause: &'static str) -> Self
pub const fn for_clause(self, clause: &'static str) -> Self
Set FOR clause
Sourcepub const fn with_check(self, expr: &'static str) -> Self
pub const fn with_check(self, expr: &'static str) -> Self
Set WITH CHECK expression
Sourcepub const fn into_policy(self) -> Policy
pub const fn into_policy(self) -> Policy
Convert to runtime Policy type
Trait Implementations§
impl Copy for PolicyDef
impl Eq for PolicyDef
impl StructuralPartialEq for PolicyDef
Auto Trait Implementations§
impl Freeze for PolicyDef
impl RefUnwindSafe for PolicyDef
impl Send for PolicyDef
impl Sync for PolicyDef
impl Unpin for PolicyDef
impl UnwindSafe for PolicyDef
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