pub struct TenantConn { /* private fields */ }Expand description
A database handle bound to the request’s tenant.
Obtained only as an axum extractor, and only on a route the resolution layer covers. There is no constructor:
ⓘ
use cratefield_core::TenantConn;
// No public constructor: a handler cannot build a handle for a
// tenant it was not given.
let _conn = TenantConn { tenant: todo!(), db: db() };Naming it is fine, which is what keeps a handler signature writable:
use cratefield_core::TenantConn;
async fn handler(_db: TenantConn) {}Implementations§
Trait Implementations§
Source§impl Clone for TenantConn
impl Clone for TenantConn
Source§fn clone(&self) -> TenantConn
fn clone(&self) -> TenantConn
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Database for TenantConn
impl Database for TenantConn
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
stmt: &'life1 Statement,
) -> Pin<Box<dyn Future<Output = Result<u64, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
stmt: &'life1 Statement,
) -> Pin<Box<dyn Future<Output = Result<Rows, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn batch_atomic<'life0, 'life1, 'async_trait>(
&'life0 self,
stmts: &'life1 [Statement],
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl Debug for TenantConn
impl Debug for TenantConn
Source§impl<S> FromRequestParts<S> for TenantConn
impl<S> FromRequestParts<S> for TenantConn
Auto Trait Implementations§
impl !RefUnwindSafe for TenantConn
impl !UnwindSafe for TenantConn
impl Freeze for TenantConn
impl Send for TenantConn
impl Sync for TenantConn
impl Unpin for TenantConn
impl UnsafeUnpin for TenantConn
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Perform the extraction.