AshClickhouse.Repo behaviour (AshClickhouse v0.6.2)

Copy Markdown View Source

Configuration module for AshClickhouse.

Define a repo in your application and add it to your supervision tree:

defmodule MyApp.Repo do
  use AshClickhouse.Repo, otp_app: :my_app
end

Then configure it in config/config.exs:

config :my_app, MyApp.Repo,
  url: "http://localhost:8123",
  database: "my_app_dev"

Options

  • :url — ClickHouse HTTP URL (default "http://localhost:8123")
  • :username / :password — credentials (default "default" / "")
  • :database — default database name
  • :pool_size — size of the connection pool (default 10)
  • :ipv4_only — resolve the URL host to an IPv4 address and connect to that literal IP (default false). Set to true when the DNS server returns NXDOMAIN for AAAA queries, which otherwise surfaces as a ClickHouse.ConnectionError with message "nxdomain".

Summary

Functions

Converts repo config to ClickHouse connection options.

Types

config()

@type config() :: keyword()

Callbacks

child_spec(keyword)

@callback child_spec(keyword()) :: Supervisor.child_spec()

config()

@callback config() :: keyword()

connection()

@callback connection() :: AshClickhouse.Connection.t() | nil

create_database(arg1)

@callback create_database(String.t() | nil) :: {:ok, term()} | {:error, term()}

database()

@callback database() :: String.t() | nil

drop_database(arg1)

@callback drop_database(String.t() | nil) :: {:ok, term()} | {:error, term()}

insert_rows(t, t, list, keyword)

@callback insert_rows(String.t(), String.t(), [list()], keyword()) ::
  {:ok, term()} | {:error, term()}

otp_app()

@callback otp_app() :: atom() | nil

Functions

config_to_conn_opts(repo_module)

@spec config_to_conn_opts(module()) :: keyword()

Converts repo config to ClickHouse connection options.