Skip to main content

postgres

Function postgres 

Source
pub async fn postgres(
    path: Option<String>,
    database: Option<String>,
    network: Option<String>,
    user: Option<String>,
    password: Option<String>,
) -> Result<(ContainerAsync<Postgres>, String)>
Expand description

Creates a Postgres container with a default configuration.

This function creates a new Postgres container with a default configuration, and returns the connection URL of the container. The container is added to the global container map for teardown.

§Parameters

  • path: The path to the Postgres image Docker mount source.
  • database: The name of the Postgres database.
  • network: The name of the Docker network to connect the container to.

§Errors

If an error occurs while creating the container, a TestError::ContainerCreation error is returned. If an error occurs while getting the IP address or port of the container, a TestError::ContainerCreation error is returned.

§Returns

A String containing the connection URL of the Postgres container.