-module(testcontainers_gleam@postgres). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/testcontainers_gleam/postgres.gleam"). -export([new/0, with_image/2, with_user/2, with_password/2, with_database/2, with_port/2, with_persistent_volume/2, with_wait_timeout/2, with_check_image/2, with_reuse/2, build/1, default_image/0, default_port/0, port/1, connection_parameters/1]). -export_type([postgres_config/0, connection_parameters/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " PostgreSQL container configuration.\n" "\n" " Wraps `Testcontainers.PostgresContainer` to provide typed builders\n" " for a PostgreSQL container. Use `new` to create a default configuration,\n" " customize with `with_*` functions, then `build` to get a `Container`.\n" "\n" " ## Example\n" "\n" " ```gleam\n" " import testcontainers_gleam\n" " import testcontainers_gleam/postgres\n" "\n" " let config = postgres.new()\n" " let container = postgres.build(config)\n" " let assert Ok(running) = testcontainers_gleam.start_container(container)\n" " let params = postgres.connection_parameters(running)\n" " ```\n" ). -type postgres_config() :: any(). -type connection_parameters() :: any(). -file("src/testcontainers_gleam/postgres.gleam", 34). ?DOC( " Create a new PostgreSQL container configuration with defaults.\n" "\n" " Default image: `postgres:15-alpine`, user/password/database: `\"test\"`,\n" " port: 5432, timeout: 60s.\n" ). -spec new() -> postgres_config(). new() -> 'Elixir.Testcontainers.PostgresContainer':new(). -file("src/testcontainers_gleam/postgres.gleam", 38). ?DOC(" Override the Docker image.\n"). -spec with_image(postgres_config(), binary()) -> postgres_config(). with_image(Config, Image) -> 'Elixir.Testcontainers.PostgresContainer':with_image(Config, Image). -file("src/testcontainers_gleam/postgres.gleam", 42). ?DOC(" Override the database user (default `\"test\"`).\n"). -spec with_user(postgres_config(), binary()) -> postgres_config(). with_user(Config, User) -> 'Elixir.Testcontainers.PostgresContainer':with_user(Config, User). -file("src/testcontainers_gleam/postgres.gleam", 46). ?DOC(" Override the database password (default `\"test\"`).\n"). -spec with_password(postgres_config(), binary()) -> postgres_config(). with_password(Config, Password) -> 'Elixir.Testcontainers.PostgresContainer':with_password(Config, Password). -file("src/testcontainers_gleam/postgres.gleam", 50). ?DOC(" Override the database name (default `\"test\"`).\n"). -spec with_database(postgres_config(), binary()) -> postgres_config(). with_database(Config, Database) -> 'Elixir.Testcontainers.PostgresContainer':with_database(Config, Database). -file("src/testcontainers_gleam/postgres.gleam", 54). ?DOC(" Override the exposed port (default 5432).\n"). -spec with_port(postgres_config(), integer()) -> postgres_config(). with_port(Config, Port) -> 'Elixir.Testcontainers.PostgresContainer':with_port(Config, Port). -file("src/testcontainers_gleam/postgres.gleam", 58). ?DOC(" Attach a persistent volume at the given path.\n"). -spec with_persistent_volume(postgres_config(), binary()) -> postgres_config(). with_persistent_volume(Config, Path) -> 'Elixir.Testcontainers.PostgresContainer':with_persistent_volume( Config, Path ). -file("src/testcontainers_gleam/postgres.gleam", 65). ?DOC(" Override the wait timeout in milliseconds (default 60000).\n"). -spec with_wait_timeout(postgres_config(), integer()) -> postgres_config(). with_wait_timeout(Config, Timeout) -> 'Elixir.Testcontainers.PostgresContainer':with_wait_timeout(Config, Timeout). -file("src/testcontainers_gleam/postgres.gleam", 69). ?DOC(" Set the regex pattern to validate the image name.\n"). -spec with_check_image(postgres_config(), binary()) -> postgres_config(). with_check_image(Config, Pattern) -> 'Elixir.Testcontainers.PostgresContainer':with_check_image(Config, Pattern). -file("src/testcontainers_gleam/postgres.gleam", 76). ?DOC(" Enable or disable container reuse across test runs.\n"). -spec with_reuse(postgres_config(), boolean()) -> postgres_config(). with_reuse(Config, Reuse) -> 'Elixir.Testcontainers.PostgresContainer':with_reuse(Config, Reuse). -file("src/testcontainers_gleam/postgres.gleam", 79). ?DOC(" Build a `Container` from this PostgreSQL configuration.\n"). -spec build(postgres_config()) -> testcontainers_gleam@container:container(). build(Config) -> testcontainers_gleam_ffi:build_container(Config). -file("src/testcontainers_gleam/postgres.gleam", 85). ?DOC(" Get the default Docker image name (without tag).\n"). -spec default_image() -> binary(). default_image() -> 'Elixir.Testcontainers.PostgresContainer':default_image(). -file("src/testcontainers_gleam/postgres.gleam", 89). ?DOC(" Get the default exposed port (5432).\n"). -spec default_port() -> integer(). default_port() -> 'Elixir.Testcontainers.PostgresContainer':default_port(). -file("src/testcontainers_gleam/postgres.gleam", 93). ?DOC(" Get the host-mapped port for the PostgreSQL container.\n"). -spec port(testcontainers_gleam@container:container()) -> integer(). port(Container) -> 'Elixir.Testcontainers.PostgresContainer':port(Container). -file("src/testcontainers_gleam/postgres.gleam", 97). ?DOC(" Get the connection parameters as an Elixir keyword list.\n"). -spec connection_parameters(testcontainers_gleam@container:container()) -> connection_parameters(). connection_parameters(Container) -> 'Elixir.Testcontainers.PostgresContainer':connection_parameters(Container).