macro_rules! db_test {
($backend:expr) => { ... };
($backend:expr, $config:expr) => { ... };
}
Expand description
A more ergonomic macro for database operations that hides all the boxing complexity
This macro provides a clean syntax for database operations without requiring the user to manually use Box::new(), Box::pin(), or boxed_async!
§Example:
ⓘ
use testkit_core::db_test;
#[tokio::test]
async fn test_database() {
let backend = MockBackend::new();
// Using the macro for a clean API
let ctx = db_test!(backend)
.setup_async(|conn| async {
// Setup operations...
Ok(())
})
.transaction(|conn| async {
// Transaction operations...
Ok(())
})
.run()
.await
.expect("Test failed");
}