pub struct TenantQueryTransformer { /* private fields */ }Expand description
Query transformer for tenant isolation
Implementations§
Source§impl TenantQueryTransformer
impl TenantQueryTransformer
Sourcepub fn register_table(
self,
table: impl Into<String>,
column: impl Into<String>,
) -> Self
pub fn register_table( self, table: impl Into<String>, column: impl Into<String>, ) -> Self
Register a table with its tenant column
Sourcepub fn register_tables(self, tables: &[&str], column: impl Into<String>) -> Self
pub fn register_tables(self, tables: &[&str], column: impl Into<String>) -> Self
Register multiple tables with the same column
Sourcepub fn exclude_table(self, table: impl Into<String>) -> Self
pub fn exclude_table(self, table: impl Into<String>) -> Self
Exclude a table from filtering
Sourcepub fn with_parameters(self) -> Self
pub fn with_parameters(self) -> Self
Use parameterized queries
Sourcepub fn with_filter_template(self, template: impl Into<String>) -> Self
pub fn with_filter_template(self, template: impl Into<String>) -> Self
Set custom filter template
Sourcepub fn get_tenant_column(&self, table: &str) -> Option<&str>
pub fn get_tenant_column(&self, table: &str) -> Option<&str>
Get the tenant column for a table
Sourcepub fn requires_filtering(&self, table: &str) -> bool
pub fn requires_filtering(&self, table: &str) -> bool
Check if a table requires filtering
Sourcepub fn transform(
&self,
query: &str,
tenant: &TenantId,
config: &TenantConfig,
) -> TransformResult
pub fn transform( &self, query: &str, tenant: &TenantId, config: &TenantConfig, ) -> TransformResult
Transform a query for a tenant
Sourcepub fn set_schema_search_path(
&self,
_tenant: &TenantId,
config: &TenantConfig,
) -> Option<String>
pub fn set_schema_search_path( &self, _tenant: &TenantId, config: &TenantConfig, ) -> Option<String>
Generate SET search_path command for schema isolation
Sourcepub fn use_database(
&self,
_tenant: &TenantId,
config: &TenantConfig,
) -> Option<String>
pub fn use_database( &self, _tenant: &TenantId, config: &TenantConfig, ) -> Option<String>
Generate USE database command for database isolation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TenantQueryTransformer
impl RefUnwindSafe for TenantQueryTransformer
impl Send for TenantQueryTransformer
impl Sync for TenantQueryTransformer
impl Unpin for TenantQueryTransformer
impl UnsafeUnpin for TenantQueryTransformer
impl UnwindSafe for TenantQueryTransformer
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more