pub struct DynamicResolver { /* private fields */ }Expand description
A dynamic resolver using a callback function.
Implementations§
Source§impl DynamicResolver
impl DynamicResolver
Sourcepub fn new<F, Fut>(f: F) -> Selfwhere
F: Fn(TenantId) -> Fut + Send + Sync + 'static,
Fut: Future<Output = QueryResult<TenantContext>> + Send + 'static,
pub fn new<F, Fut>(f: F) -> Selfwhere
F: Fn(TenantId) -> Fut + Send + Sync + 'static,
Fut: Future<Output = QueryResult<TenantContext>> + Send + 'static,
Create a new dynamic resolver with a callback.
Trait Implementations§
Source§impl Debug for DynamicResolver
impl Debug for DynamicResolver
Source§impl TenantResolver for DynamicResolver
impl TenantResolver for DynamicResolver
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 DynamicResolver
impl !RefUnwindSafe for DynamicResolver
impl Send for DynamicResolver
impl Sync for DynamicResolver
impl Unpin for DynamicResolver
impl !UnwindSafe for DynamicResolver
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