pub struct DatabaseResolver<F>where
F: Fn(String) -> Pin<Box<dyn Future<Output = QueryResult<Option<TenantInfo>>> + Send>> + Send + Sync,{ /* private fields */ }Expand description
A resolver that looks up tenants from the database.
Implementations§
Source§impl<F> DatabaseResolver<F>
impl<F> DatabaseResolver<F>
Sourcepub fn with_cache_ttl(self, ttl: Duration) -> Self
pub fn with_cache_ttl(self, ttl: Duration) -> Self
Set the cache TTL.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the cache.
Sourcepub fn invalidate(&self, tenant_id: &str)
pub fn invalidate(&self, tenant_id: &str)
Invalidate a specific tenant in the cache.
Trait Implementations§
Source§impl<F> Debug for DatabaseResolver<F>
impl<F> Debug for DatabaseResolver<F>
Source§impl<F> TenantResolver for DatabaseResolver<F>
impl<F> TenantResolver for DatabaseResolver<F>
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<F> Freeze for DatabaseResolver<F>where
F: Freeze,
impl<F> RefUnwindSafe for DatabaseResolver<F>where
F: RefUnwindSafe,
impl<F> Send for DatabaseResolver<F>
impl<F> Sync for DatabaseResolver<F>
impl<F> Unpin for DatabaseResolver<F>where
F: Unpin,
impl<F> UnwindSafe for DatabaseResolver<F>where
F: UnwindSafe,
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