pub struct RowLevelConfig {
pub column: String,
pub column_type: ColumnType,
pub excluded_tables: HashSet<String>,
pub shared_tables: HashSet<String>,
pub auto_insert: bool,
pub validate_writes: bool,
pub use_database_rls: bool,
}Expand description
Configuration for row-level tenant isolation.
Fields§
§column: StringThe column name that stores the tenant ID.
column_type: ColumnTypeThe column type (for type-safe comparisons).
excluded_tables: HashSet<String>Tables that should be excluded from tenant filtering.
Tables that are shared across all tenants.
auto_insert: boolWhether to automatically add tenant_id to INSERT statements.
validate_writes: boolWhether to validate tenant_id on UPDATE/DELETE.
use_database_rls: boolWhether to use database-level RLS (PostgreSQL).
Implementations§
Source§impl RowLevelConfig
impl RowLevelConfig
Sourcepub fn new(column: impl Into<String>) -> Self
pub fn new(column: impl Into<String>) -> Self
Create a new row-level config with the given column name.
Sourcepub fn with_column_type(self, column_type: ColumnType) -> Self
pub fn with_column_type(self, column_type: ColumnType) -> Self
Set the column type.
Sourcepub fn exclude_table(self, table: impl Into<String>) -> Self
pub fn exclude_table(self, table: impl Into<String>) -> Self
Exclude a table from tenant filtering.
Mark a table as shared (no tenant filtering).
Sourcepub fn without_auto_insert(self) -> Self
pub fn without_auto_insert(self) -> Self
Disable automatic tenant_id insertion.
Sourcepub fn without_write_validation(self) -> Self
pub fn without_write_validation(self) -> Self
Disable write validation.
Sourcepub fn with_database_rls(self) -> Self
pub fn with_database_rls(self) -> Self
Enable PostgreSQL database-level RLS.
Sourcepub fn should_filter(&self, table: &str) -> bool
pub fn should_filter(&self, table: &str) -> bool
Check if a table should be filtered.
Trait Implementations§
Source§impl Clone for RowLevelConfig
impl Clone for RowLevelConfig
Source§fn clone(&self) -> RowLevelConfig
fn clone(&self) -> RowLevelConfig
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 RowLevelConfig
impl RefUnwindSafe for RowLevelConfig
impl Send for RowLevelConfig
impl Sync for RowLevelConfig
impl Unpin for RowLevelConfig
impl UnwindSafe for RowLevelConfig
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