Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Apr 17, 2023
1 parent 70884e4 commit 12f369a
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
Ecto Adapter for ClickHouse using [`:ch`](https://github.com/plausible/ch)
# Ecto ClickHouse Adapter

<!-- [![Hex Package](https://img.shields.io/hexpm/v/chto.svg)](https://hex.pm/packages/chto)
[![Hex Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/chto) -->

Uses [`:ch`](https://github.com/plausible/ch) as driver.

## Installation

```elixir
defp deps do
[
{:chto, github: "plausible/chto"}
]
end
```

## Usage

<details>
<summary>Define repo and start <code>DBConnection</code> pool</summary>

```elixir
defmodule MyApp.Repo do
use Ecto.Repo,
adapter: Ecto.Adapters.ClickHouse,
otp_app: :my_app
end
```

```elixir
config :my_app, ecto_repos: [MyApp.Repo]
config :my_app, MyApp.Repo,
url: "http://username:password@localhost:8123/default"
```

```elixir
MyApp.Repo.start_link()
```

</details>

```elixir
## speedrun

iex> Mix.install([{:chto, github: "plausible/chto"}])

iex> defmodule Repo do
use Ecto.Repo, adapter: Ecto.Adapters.ClickHouse, otp_app: :example
end
iex>

iex> import Ecto.Query
iex> Repo.start_link()
Expand Down

0 comments on commit 12f369a

Please sign in to comment.