Packages
Elixir client for ClickHouse, a fast open-source Online Analytical Processing (OLAP) database management system. Forked from https://github.com/balance-platform/pillar to support CH25+
Current section
Files
Jump to
Current section
Files
lib/pillar/http_client.ex
defmodule Pillar.HttpClient do
@moduledoc false
@default_http_adapter Pillar.HttpClient.TeslaMintAdapter
@spec post(String.t(), String.t(), Keyword.t()) ::
Pillar.HttpClient.Response.t()
| Pillar.HttpClient.TransportError.t()
| %{__struct__: RuntimeError, message: String.t()}
def post(url, post_body \\ "", options \\ [timeout: 10_000]) do
http_adapter = adapter()
if Code.ensure_loaded?(http_adapter) && function_exported?(http_adapter, :post, 3) do
http_adapter.post(url, post_body, options)
else
%RuntimeError{message: "#{inspect(http_adapter)} is not loaded or unknown"}
end
end
def adapter do
module =
Application.get_all_env(:pillar)
|> Access.get(__MODULE__, [])
|> Access.get(:http_adapter)
module || @default_http_adapter
end
end