pub struct RlsManager { /* private fields */ }Expand description
Manager for PostgreSQL RLS operations.
Implementations§
Source§impl RlsManager
impl RlsManager
Sourcepub fn simple(
tenant_column: impl Into<String>,
session_var: impl Into<String>,
) -> Self
pub fn simple( tenant_column: impl Into<String>, session_var: impl Into<String>, ) -> Self
Create with simple defaults.
Sourcepub fn enable_rls_sql(&self, table: &str) -> String
pub fn enable_rls_sql(&self, table: &str) -> String
Generate SQL to enable RLS on a table.
Sourcepub fn force_rls_sql(&self, table: &str) -> String
pub fn force_rls_sql(&self, table: &str) -> String
Generate SQL to force RLS even for table owners.
Sourcepub fn create_policy_sql(&self, table: &str) -> String
pub fn create_policy_sql(&self, table: &str) -> String
Generate SQL for the tenant isolation policy.
Sourcepub fn create_uuid_policy_sql(&self, table: &str) -> String
pub fn create_uuid_policy_sql(&self, table: &str) -> String
Generate SQL for UUID tenant columns.
Sourcepub fn drop_policy_sql(&self, table: &str) -> String
pub fn drop_policy_sql(&self, table: &str) -> String
Generate SQL to drop a policy.
Sourcepub fn set_tenant_sql(&self, tenant_id: &str) -> String
pub fn set_tenant_sql(&self, tenant_id: &str) -> String
Generate SQL to set the current tenant for a session.
Sourcepub fn set_tenant_local_sql(&self, tenant_id: &str) -> String
pub fn set_tenant_local_sql(&self, tenant_id: &str) -> String
Generate SQL to set the current tenant locally (transaction only).
Sourcepub fn reset_tenant_sql(&self) -> String
pub fn reset_tenant_sql(&self) -> String
Generate SQL to reset the tenant context.
Sourcepub fn current_tenant_sql(&self) -> String
pub fn current_tenant_sql(&self) -> String
Generate SQL to check the current tenant.
Sourcepub fn migration_up_sql(&self, table: &str) -> String
pub fn migration_up_sql(&self, table: &str) -> String
Generate migration SQL to add RLS to a new table.
Sourcepub fn migration_down_sql(&self, table: &str) -> String
pub fn migration_down_sql(&self, table: &str) -> String
Generate migration SQL to remove RLS from a table.
Trait Implementations§
Source§impl Clone for RlsManager
impl Clone for RlsManager
Source§fn clone(&self) -> RlsManager
fn clone(&self) -> RlsManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RlsManager
impl RefUnwindSafe for RlsManager
impl Send for RlsManager
impl Sync for RlsManager
impl Unpin for RlsManager
impl UnwindSafe for RlsManager
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