pub struct StaticResolver { /* private fields */ }Expand description
A static resolver that maps tenant IDs to contexts.
Implementations§
Source§impl StaticResolver
impl StaticResolver
Sourcepub fn register(
&self,
tenant_id: impl Into<String>,
context: TenantContext,
) -> &Self
pub fn register( &self, tenant_id: impl Into<String>, context: TenantContext, ) -> &Self
Register a tenant.
Sourcepub fn register_simple(&self, tenant_id: impl Into<String>) -> &Self
pub fn register_simple(&self, tenant_id: impl Into<String>) -> &Self
Register a simple tenant with just an ID.
Sourcepub fn unregister(&self, tenant_id: &str) -> Option<TenantContext>
pub fn unregister(&self, tenant_id: &str) -> Option<TenantContext>
Unregister a tenant.
Trait Implementations§
Source§impl Clone for StaticResolver
impl Clone for StaticResolver
Source§fn clone(&self) -> StaticResolver
fn clone(&self) -> StaticResolver
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 StaticResolver
impl Debug for StaticResolver
Source§impl Default for StaticResolver
impl Default for StaticResolver
Source§fn default() -> StaticResolver
fn default() -> StaticResolver
Returns the “default value” for a type. Read more
Source§impl TenantResolver for StaticResolver
impl TenantResolver for StaticResolver
Source§fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<TenantContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<TenantContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Resolve a tenant ID to a full tenant context.
Source§fn validate<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate that a tenant exists and is active.
Source§fn schema_for<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn schema_for<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the schema name for a tenant (schema-based isolation).
Source§fn database_for<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn database_for<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: &'life1 TenantId,
) -> Pin<Box<dyn Future<Output = QueryResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the database name for a tenant (database-based isolation).
Auto Trait Implementations§
impl Freeze for StaticResolver
impl RefUnwindSafe for StaticResolver
impl Send for StaticResolver
impl Sync for StaticResolver
impl Unpin for StaticResolver
impl UnwindSafe for StaticResolver
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)