pub enum DynamicExecutor<'executor> {
Database(&'executor Database),
Transaction(&'executor mut Transaction),
}
Expand description
Choose whether to use transactions or not at runtime
Like a Box<dyn Executor<'executor>>
Variants§
Database(&'executor Database)
Use a default database connection
Transaction(&'executor mut Transaction)
Use a transaction
Trait Implementations§
Source§impl<'executor> Executor<'executor> for DynamicExecutor<'executor>
impl<'executor> Executor<'executor> for DynamicExecutor<'executor>
Source§type EnsureTransactionFuture = Pin<Box<dyn Future<Output = Result<TransactionGuard<'executor>, Error>> + Send + 'executor>>
type EnsureTransactionFuture = Pin<Box<dyn Future<Output = Result<TransactionGuard<'executor>, Error>> + Send + 'executor>>
A future producing a
TransactionGuard
returned by ensure_transaction
Source§fn execute<'data, 'result, Q>(
self,
query: String,
values: Vec<Value<'data>>,
) -> Q::Result<'result>where
Q: QueryStrategy,
'executor: 'result,
'data: 'result,
fn execute<'data, 'result, Q>(
self,
query: String,
values: Vec<Value<'data>>,
) -> Q::Result<'result>where
Q: QueryStrategy,
'executor: 'result,
'data: 'result,
Executes a raw SQL query Read more
Source§fn into_dyn(self) -> DynamicExecutor<'executor>
fn into_dyn(self) -> DynamicExecutor<'executor>
Convenience method to convert into a “
dyn Executor
”Source§fn ensure_transaction(self) -> Self::EnsureTransactionFuture
fn ensure_transaction(self) -> Self::EnsureTransactionFuture
Ensure a piece of code is run inside a transaction using a
TransactionGuard
. Read moreAuto Trait Implementations§
impl<'executor> Freeze for DynamicExecutor<'executor>
impl<'executor> !RefUnwindSafe for DynamicExecutor<'executor>
impl<'executor> Send for DynamicExecutor<'executor>
impl<'executor> Sync for DynamicExecutor<'executor>
impl<'executor> Unpin for DynamicExecutor<'executor>
impl<'executor> !UnwindSafe for DynamicExecutor<'executor>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more