pub struct RlsPolicy {
pub name: String,
pub table: String,
pub command: PolicyCommand,
pub roles: Vec<String>,
pub using: Option<String>,
pub with_check: Option<String>,
pub permissive: bool,
}Expand description
A Row-Level Security policy definition.
Fields§
§name: StringPolicy name.
table: StringTable the policy applies to.
command: PolicyCommandPolicy command (SELECT, INSERT, UPDATE, DELETE, ALL).
roles: Vec<String>Role(s) the policy applies to.
using: Option<String>USING expression (for SELECT, UPDATE, DELETE).
with_check: Option<String>WITH CHECK expression (for INSERT, UPDATE).
permissive: boolWhether this is a permissive or restrictive policy.
Implementations§
Source§impl RlsPolicy
impl RlsPolicy
Sourcepub fn new(
name: impl Into<String>,
table: impl Into<String>,
) -> RlsPolicyBuilder
pub fn new( name: impl Into<String>, table: impl Into<String>, ) -> RlsPolicyBuilder
Create a new RLS policy.
Sourcepub fn to_postgres_sql(&self) -> String
pub fn to_postgres_sql(&self) -> String
Generate PostgreSQL CREATE POLICY SQL.
Sourcepub fn to_mssql_sql(&self) -> Vec<String>
pub fn to_mssql_sql(&self) -> Vec<String>
Generate MSSQL security predicate SQL.
Sourcepub fn to_drop_sql(&self, db_type: DatabaseType) -> String
pub fn to_drop_sql(&self, db_type: DatabaseType) -> String
Generate DROP POLICY SQL.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RlsPolicy
impl<'de> Deserialize<'de> for RlsPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RlsPolicy
impl StructuralPartialEq for RlsPolicy
Auto Trait Implementations§
impl Freeze for RlsPolicy
impl RefUnwindSafe for RlsPolicy
impl Send for RlsPolicy
impl Sync for RlsPolicy
impl Unpin for RlsPolicy
impl UnwindSafe for RlsPolicy
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