pub struct SchemaConfig {
pub schema_prefix: Option<String>,
pub schema_suffix: Option<String>,
pub shared_schema: Option<String>,
pub auto_create: bool,
pub default_schema: Option<String>,
pub search_path_format: SearchPathFormat,
}Expand description
Configuration for schema-based tenant isolation.
Fields§
§schema_prefix: Option<String>Prefix for tenant schema names (e.g., “tenant_” -> “tenant_acme”).
schema_suffix: Option<String>Suffix for tenant schema names.
Name of the shared schema for common tables.
auto_create: boolWhether to create schemas automatically.
default_schema: Option<String>Default schema for new tenants.
search_path_format: SearchPathFormatSchema search path format.
Implementations§
Source§impl SchemaConfig
impl SchemaConfig
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Set the schema prefix.
Sourcepub fn with_suffix(self, suffix: impl Into<String>) -> Self
pub fn with_suffix(self, suffix: impl Into<String>) -> Self
Set the schema suffix.
Set the shared schema name.
Sourcepub fn with_auto_create(self) -> Self
pub fn with_auto_create(self) -> Self
Enable auto-creation of schemas.
Sourcepub fn with_default_schema(self, schema: impl Into<String>) -> Self
pub fn with_default_schema(self, schema: impl Into<String>) -> Self
Set the default schema.
Sourcepub fn with_search_path(self, format: SearchPathFormat) -> Self
pub fn with_search_path(self, format: SearchPathFormat) -> Self
Set the search path format.
Sourcepub fn schema_name(&self, tenant_id: &str) -> String
pub fn schema_name(&self, tenant_id: &str) -> String
Generate the schema name for a tenant.
Sourcepub fn search_path(&self, tenant_id: &str) -> String
pub fn search_path(&self, tenant_id: &str) -> String
Generate the search_path SQL for a tenant.
Trait Implementations§
Source§impl Clone for SchemaConfig
impl Clone for SchemaConfig
Source§fn clone(&self) -> SchemaConfig
fn clone(&self) -> SchemaConfig
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaConfig
impl Debug for SchemaConfig
Source§impl Default for SchemaConfig
impl Default for SchemaConfig
Source§fn default() -> SchemaConfig
fn default() -> SchemaConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SchemaConfig
impl RefUnwindSafe for SchemaConfig
impl Send for SchemaConfig
impl Sync for SchemaConfig
impl Unpin for SchemaConfig
impl UnwindSafe for SchemaConfig
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)