pub struct TestDatabase { /* private fields */ }Expand description
Implementations§
Source§impl TestDatabase
impl TestDatabase
Sourcepub async fn from_env() -> Result<Self>
pub async fn from_env() -> Result<Self>
Connect using TEST_DATABASE_URL, or start a container if the
testcontainers feature is enabled and the var is unset.
Sourcepub async fn execute(&self, sql: &str) -> Result<()>
pub async fn execute(&self, sql: &str) -> Result<()>
Run raw SQL to set up test data or schema.
Sourcepub async fn isolated(&self, test_name: &str) -> Result<IsolatedTestDb>
pub async fn isolated(&self, test_name: &str) -> Result<IsolatedTestDb>
Creates a dedicated database for a single test, providing full isolation.
Each call creates a new database with a unique name. Use this when tests modify data and could interfere with each other.
Auto Trait Implementations§
impl Freeze for TestDatabase
impl !RefUnwindSafe for TestDatabase
impl Send for TestDatabase
impl Sync for TestDatabase
impl Unpin for TestDatabase
impl UnsafeUnpin for TestDatabase
impl !UnwindSafe for TestDatabase
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