pub struct BoxedDatabaseEntryPoint<DB>{ /* private fields */ }
Expand description
Entry point for database operations with automatic boxing of closures
This provides functionality for database operations with automatic boxing
of future closures to solve lifetime issues. Use the boxed_async!
macro
to easily create boxed async blocks.
Implementations§
Source§impl<DB> BoxedDatabaseEntryPoint<DB>
impl<DB> BoxedDatabaseEntryPoint<DB>
Sourcepub fn setup<F>(self, setup_fn: F) -> BoxedSetupHandler<DB>
pub fn setup<F>(self, setup_fn: F) -> BoxedSetupHandler<DB>
Set up the database with the given function
This method takes a closure that will be executed during setup.
Use the boxed_async!
macro to create an async block that captures
variables without lifetime issues.
Sourcepub fn with_transaction<F>(
self,
transaction_fn: F,
) -> BoxedTransactionOnlyHandler<DB>
pub fn with_transaction<F>( self, transaction_fn: F, ) -> BoxedTransactionOnlyHandler<DB>
Initialize a database with a transaction
Sourcepub async fn execute(self) -> Result<TestContext<DB>, DB::Error>
pub async fn execute(self) -> Result<TestContext<DB>, DB::Error>
Execute this handler
Sourcepub fn setup_async<F, Fut>(self, setup_fn: F) -> BoxedSetupHandler<DB>
pub fn setup_async<F, Fut>(self, setup_fn: F) -> BoxedSetupHandler<DB>
Add an async setup function without requiring boxed_async
This method provides a more ergonomic API without requiring manual boxing
Sourcepub fn transaction<F, Fut>(
self,
transaction_fn: F,
) -> BoxedTransactionOnlyHandler<DB>where
F: FnOnce(&mut <DB as DatabaseBackend>::Connection) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<(), DB::Error>> + Send + 'static,
pub fn transaction<F, Fut>(
self,
transaction_fn: F,
) -> BoxedTransactionOnlyHandler<DB>where
F: FnOnce(&mut <DB as DatabaseBackend>::Connection) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<(), DB::Error>> + Send + 'static,
Add a transaction function without requiring boxed_async
This method provides a more ergonomic API without requiring manual boxing
Sourcepub async fn run(self) -> Result<TestContext<DB>, DB::Error>
pub async fn run(self) -> Result<TestContext<DB>, DB::Error>
Run the handler
This is an alias for execute() with a more intuitive name