pub struct TempDb {
pub url: String,
/* private fields */
}Expand description
A fresh database named fz_<tag>_<pid>_<n> on the given server;
call TempDb::finish to drop it.
Fields§
§url: StringThe connection string of the throwaway database.
Implementations§
Source§impl TempDb
impl TempDb
Sourcepub async fn create(base: &str, tag: &str) -> Option<Self>
pub async fn create(base: &str, tag: &str) -> Option<Self>
Creates a throwaway database on base (the value of
FZ_TEST_POSTGRES_URL). The name is unique per process and per
call, so a previous run’s leaked databases (a test that panicked
before finish) never collide.
§Panics
Panics when the server refuses connections or cannot create the
database — callers gate on base_url so a missing server is a
skip, not a panic.
Sourcepub async fn assert_postgres_16(&self)
pub async fn assert_postgres_16(&self)
Asserts the server is the major version the contract is about.
§Panics
Panics when the server is not Postgres 16.
Auto Trait Implementations§
impl !RefUnwindSafe for TempDb
impl !UnwindSafe for TempDb
impl Freeze for TempDb
impl Send for TempDb
impl Sync for TempDb
impl Unpin for TempDb
impl UnsafeUnpin for TempDb
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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