pub struct TenantMiddleware { /* private fields */ }Expand description
Middleware that automatically applies tenant filtering to queries.
Implementations§
Source§impl TenantMiddleware
impl TenantMiddleware
Sourcepub fn new(config: TenantConfig) -> Self
pub fn new(config: TenantConfig) -> Self
Create a new tenant middleware with the given config.
Sourcepub fn set_tenant(&self, ctx: TenantContext)
pub fn set_tenant(&self, ctx: TenantContext)
Set the current tenant context.
Sourcepub fn clear_tenant(&self)
pub fn clear_tenant(&self)
Clear the current tenant context.
Sourcepub fn current_tenant(&self) -> Option<TenantContext>
pub fn current_tenant(&self) -> Option<TenantContext>
Get the current tenant context.
Sourcepub fn scoped(&self, ctx: TenantContext) -> TenantScope
pub fn scoped(&self, ctx: TenantContext) -> TenantScope
Create a scoped tenant context (automatically clears on drop).
Trait Implementations§
Source§impl Clone for TenantMiddleware
impl Clone for TenantMiddleware
Source§impl Debug for TenantMiddleware
impl Debug for TenantMiddleware
Source§impl Middleware for TenantMiddleware
impl Middleware for TenantMiddleware
Source§fn handle<'a>(
&'a self,
ctx: QueryContext,
next: Next<'a>,
) -> BoxFuture<'a, QueryResult<QueryResponse>>
fn handle<'a>( &'a self, ctx: QueryContext, next: Next<'a>, ) -> BoxFuture<'a, QueryResult<QueryResponse>>
Handle a query, optionally calling the next handler.
Auto Trait Implementations§
impl Freeze for TenantMiddleware
impl !RefUnwindSafe for TenantMiddleware
impl Send for TenantMiddleware
impl Sync for TenantMiddleware
impl Unpin for TenantMiddleware
impl !UnwindSafe for TenantMiddleware
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)