Shared helpers for the ash_clickhouse mix tasks.
Both mix ash_clickhouse.setup and mix ash_clickhouse.migrate need to
enumerate the app's compiled modules to find AshClickhouse repos and
resources. Centralising this keeps the two tasks consistent and avoids
duplicated discovery logic.
Summary
Functions
Returns the configured Mix.Project.config()[:app] name, or nil if none.
Returns every module compiled into the app that declares
__ash_clickhouse_repo__/0 (i.e. AshClickhouse repos).
Returns every module compiled into the app that declares
__ash_clickhouse__/1 (i.e. AshClickhouse resources).
Starts the ClickHouse connection for each repo.
Functions
@spec app_name() :: atom() | nil
Returns the configured Mix.Project.config()[:app] name, or nil if none.
@spec find_repos() :: [module()]
Returns every module compiled into the app that declares
__ash_clickhouse_repo__/0 (i.e. AshClickhouse repos).
@spec find_resources() :: [module()]
Returns every module compiled into the app that declares
__ash_clickhouse__/1 (i.e. AshClickhouse resources).
Starts the ClickHouse connection for each repo.
Mix tasks (mix ash_clickhouse.setup, mix ash_clickhouse.migrate) run
queries through the repos, so the client must be registered even when the
application itself is not started.