RowLevelConfig

Struct RowLevelConfig 

Source
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: String

The column name that stores the tenant ID.

§column_type: ColumnType

The column type (for type-safe comparisons).

§excluded_tables: HashSet<String>

Tables that should be excluded from tenant filtering.

§shared_tables: HashSet<String>

Tables that are shared across all tenants.

§auto_insert: bool

Whether to automatically add tenant_id to INSERT statements.

§validate_writes: bool

Whether to validate tenant_id on UPDATE/DELETE.

§use_database_rls: bool

Whether to use database-level RLS (PostgreSQL).

Implementations§

Source§

impl RowLevelConfig

Source

pub fn new(column: impl Into<String>) -> Self

Create a new row-level config with the given column name.

Source

pub fn with_column_type(self, column_type: ColumnType) -> Self

Set the column type.

Source

pub fn exclude_table(self, table: impl Into<String>) -> Self

Exclude a table from tenant filtering.

Source

pub fn shared_table(self, table: impl Into<String>) -> Self

Mark a table as shared (no tenant filtering).

Source

pub fn without_auto_insert(self) -> Self

Disable automatic tenant_id insertion.

Source

pub fn without_write_validation(self) -> Self

Disable write validation.

Source

pub fn with_database_rls(self) -> Self

Enable PostgreSQL database-level RLS.

Source

pub fn should_filter(&self, table: &str) -> bool

Check if a table should be filtered.

Trait Implementations§

Source§

impl Clone for RowLevelConfig

Source§

fn clone(&self) -> RowLevelConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RowLevelConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more