Packages

A real-time time series database - command line client.

Retired package: I'll never finish it

Current section

Files

Jump to
phasedb_client lib phasedb client.ex
Raw

lib/phasedb/client.ex

defmodule PhaseDB.Client do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
supervisor(PhaseDB.Client.RequestSupervisor, []),
supervisor(PhaseDB.Client.ConnectionSupervisor, [])
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: PhaseDB.Client]
Supervisor.start_link(children, opts)
end
def execute query, uri do
{:ok, connection_pid} = PhaseDB.Client.Connection.find_or_create uri
{:ok, request_pid} = PhaseDB.Client.Request.create query, connection_pid
PhaseDB.Client.Request.await request_pid
end
def default_uri do
"ws://localhost:63157"
end
end