pub struct TestDatabase { /* private fields */ }Expand description
Database access for tests.
Implementations§
Source§impl TestDatabase
impl TestDatabase
pub async fn from_url(url: &str) -> Result<Self>
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.
pub fn pool(&self) -> &PgPool
pub fn url(&self) -> &str
Sourcepub async fn isolated(&self, test_name: &str) -> Result<IsolatedTestDb>
pub async fn isolated(&self, test_name: &str) -> Result<IsolatedTestDb>
Create a dedicated database for a single test, providing full isolation.
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