Current section
Files
Jump to
Current section
Files
src/testcontainers_gleam@cassandra.erl
-module(testcontainers_gleam@cassandra).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/testcontainers_gleam/cassandra.gleam").
-export([new/0, with_image/2, with_check_image/2, with_reuse/2, build/1, default_image/0, default_port/0, get_username/0, get_password/0, port/1, connection_uri/1]).
-export_type([cassandra_config/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(
" Cassandra container configuration.\n"
"\n"
" Wraps `Testcontainers.CassandraContainer` to provide typed builders\n"
" for a Cassandra 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/cassandra\n"
"\n"
" let config = cassandra.new()\n"
" let container = cassandra.build(config)\n"
" let assert Ok(running) = testcontainers_gleam.start_container(container)\n"
" let uri = cassandra.connection_uri(running)\n"
" ```\n"
).
-type cassandra_config() :: any().
-file("src/testcontainers_gleam/cassandra.gleam", 30).
?DOC(
" Create a new Cassandra container configuration with defaults.\n"
"\n"
" Default image: `cassandra:3.11.2`, port: 9042, timeout: 60s,\n"
" credentials: cassandra/cassandra.\n"
).
-spec new() -> cassandra_config().
new() ->
'Elixir.Testcontainers.CassandraContainer':new().
-file("src/testcontainers_gleam/cassandra.gleam", 34).
?DOC(" Override the Docker image.\n").
-spec with_image(cassandra_config(), binary()) -> cassandra_config().
with_image(Config, Image) ->
'Elixir.Testcontainers.CassandraContainer':with_image(Config, Image).
-file("src/testcontainers_gleam/cassandra.gleam", 38).
?DOC(" Set the regex pattern to validate the image name.\n").
-spec with_check_image(cassandra_config(), binary()) -> cassandra_config().
with_check_image(Config, Pattern) ->
'Elixir.Testcontainers.CassandraContainer':with_check_image(Config, Pattern).
-file("src/testcontainers_gleam/cassandra.gleam", 45).
?DOC(" Enable or disable container reuse across test runs.\n").
-spec with_reuse(cassandra_config(), boolean()) -> cassandra_config().
with_reuse(Config, Reuse) ->
'Elixir.Testcontainers.CassandraContainer':with_reuse(Config, Reuse).
-file("src/testcontainers_gleam/cassandra.gleam", 48).
?DOC(" Build a `Container` from this Cassandra configuration.\n").
-spec build(cassandra_config()) -> testcontainers_gleam@container:container().
build(Config) ->
testcontainers_gleam_ffi:build_container(Config).
-file("src/testcontainers_gleam/cassandra.gleam", 54).
?DOC(" Get the default Docker image name (without tag).\n").
-spec default_image() -> binary().
default_image() ->
'Elixir.Testcontainers.CassandraContainer':default_image().
-file("src/testcontainers_gleam/cassandra.gleam", 58).
?DOC(" Get the default exposed port (9042).\n").
-spec default_port() -> integer().
default_port() ->
'Elixir.Testcontainers.CassandraContainer':default_port().
-file("src/testcontainers_gleam/cassandra.gleam", 62).
?DOC(" Get the default username (`\"cassandra\"`).\n").
-spec get_username() -> binary().
get_username() ->
'Elixir.Testcontainers.CassandraContainer':get_username().
-file("src/testcontainers_gleam/cassandra.gleam", 66).
?DOC(" Get the default password (`\"cassandra\"`).\n").
-spec get_password() -> binary().
get_password() ->
'Elixir.Testcontainers.CassandraContainer':get_password().
-file("src/testcontainers_gleam/cassandra.gleam", 70).
?DOC(" Get the host-mapped port for the Cassandra container.\n").
-spec port(testcontainers_gleam@container:container()) -> integer().
port(Container) ->
'Elixir.Testcontainers.CassandraContainer':port(Container).
-file("src/testcontainers_gleam/cassandra.gleam", 74).
?DOC(" Get the Cassandra connection URI (e.g. `\"cassandra://localhost:32768/\"`).\n").
-spec connection_uri(testcontainers_gleam@container:container()) -> binary().
connection_uri(Container) ->
'Elixir.Testcontainers.CassandraContainer':connection_uri(Container).