View Source Ch (Ch v0.2.9)
Minimal HTTP ClickHouse client.
Summary
Functions
Returns a supervisor child specification for a DBConnection pool.
Runs a query and returns the result as {:ok, %Ch.Result{}}
or
{:error, Exception.t()}
if there was a database error.
Start the connection process and connect to ClickHouse.
Types
@type query_option() :: common_option() | {:command, Ch.Query.command()} | {:headers, [{String.t(), String.t()}]} | {:format, String.t()} | {:encode, boolean()} | {:decode, boolean()} | DBConnection.connection_option()
@type start_option() :: common_option() | {:scheme, String.t()} | {:hostname, String.t()} | {:port, :inet.port_number()} | {:transport_opts, :gen_tcp.connect_option()} | DBConnection.start_option()
Functions
@spec child_spec([start_option()]) :: :supervisor.child_spec()
Returns a supervisor child specification for a DBConnection pool.
See start_link/1
for supported options.
@spec query(DBConnection.conn(), iodata(), params, [query_option()]) :: {:ok, Ch.Result.t()} | {:error, Exception.t()} when params: map() | [term()] | [row :: [term()]] | iodata() | Enumerable.t()
Runs a query and returns the result as {:ok, %Ch.Result{}}
or
{:error, Exception.t()}
if there was a database error.
Options
:database
- Database:username
- Username:password
- User password:settings
- Keyword list of settings:timeout
- Query request timeout:command
- Command tag for the query:headers
- Custom HTTP headers for the request:format
- Custom response format for the request:decode
- Whether to automatically decode the responseDBConnection.connection_option()
@spec query!(DBConnection.conn(), iodata(), params, [query_option()]) :: Ch.Result.t() when params: map() | [term()] | [row :: [term()]] | iodata() | Enumerable.t()
Runs a query and returns the result or raises Ch.Error
if
there was an error. See query/4
.
@spec start_link([start_option()]) :: GenServer.on_start()
Start the connection process and connect to ClickHouse.
Options
:scheme
- HTTP scheme, defaults to"http"
:hostname
- server hostname, defaults to"localhost"
:port
- HTTP port, defaults to8123
:transport_opts
- options to be given to the transport being used. SeeMint.HTTP1.connect/4
for more info:database
- Database, defaults to"default"
:username
- Username:password
- User password:settings
- Keyword list of ClickHouse settings:timeout
- HTTP receive timeout in milliseconds:transport_opts
- options to be given to the transport being used. SeeMint.HTTP1.connect/4
for more infoDBConnection.start_option()