pub struct PostgresContainer { /* private fields */ }Expand description
A single-node PostgreSQL container.
Implementations§
Source§impl PostgresContainer
impl PostgresContainer
Sourcepub fn new() -> Self
pub fn new() -> Self
Builds a container from the pinned default image (postgres:18-alpine) —
18.4 was current stable at the time of that pin.
Sourcepub fn with_image(image: &str) -> Self
pub fn with_image(image: &str) -> Self
Builds a container from a caller-chosen image.
Sourcepub fn with_username(self, username: &str) -> Self
pub fn with_username(self, username: &str) -> Self
Overrides POSTGRES_USER (default test).
Sourcepub fn with_password(self, password: &str) -> Self
pub fn with_password(self, password: &str) -> Self
Overrides POSTGRES_PASSWORD (default test).
Sourcepub fn with_database(self, database: &str) -> Self
pub fn with_database(self, database: &str) -> Self
Overrides POSTGRES_DB (default test).
Sourcepub async fn start(self) -> Result<PostgresGuard>
pub async fn start(self) -> Result<PostgresGuard>
Boots the container.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PostgresContainer
impl !UnwindSafe for PostgresContainer
impl Freeze for PostgresContainer
impl Send for PostgresContainer
impl Sync for PostgresContainer
impl Unpin for PostgresContainer
impl UnsafeUnpin for PostgresContainer
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