# `AshClickhouse.Repo`
[🔗](https://github.com/ohhi-vn/ash_clickhouse/blob/main/lib/ash_clickhouse/repo.ex#L1)

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`)

# `config`

```elixir
@type config() :: keyword()
```

# `child_spec`

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

# `config`

```elixir
@callback config() :: keyword()
```

# `connection`

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

# `create_database`

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

# `database`

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

# `drop_database`

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

# `insert_rows`

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

# `config_to_conn_opts`

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

Converts repo config to ClickHouse connection options.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
