Instream v0.11.0 Instream.Connection behaviour
Connection (pool) definition.
All database connections will be made using a user-defined extension of this module.
Example Module
defmodule MyConnection do
use Instream.Connection, otp_app: :my_application
end
Example Configuration
config :my_application, MyConnection,
auth: [ method: :basic, username: "root", password: "root" ]
hosts: [ "primary.example.com", "secondary.example.com" ],
http_opts: [ insecure: true, proxy: "http://company.proxy" ],
loggers: [{ LogModule, :log_fun, [ :additional, :args ] }],
password: "pass",
pool: [ max_overflow: 10, size: 5 ],
port: 8086,
scheme: "http",
username: "user"
Summary
Callbacks
Sends a log entry to all configured loggers
Returns the (internal) pool module
Returns a supervisable pool child_spec
Returns the connection configuration
Executes a query
Pings a server in the connected cluster
Executes a reading query
Checks the status of a connection (= cluster)
Executes a writing query
Types
Callbacks
Sends a log entry to all configured loggers.
Specs
execute(query :: query_type, opts :: Keyword.t) :: any
Executes a query.
Passing [async: true]
in the options always returns :ok.
The command will be executed asynchronously.
Pings a server in the connected cluster.
By default the first server in your connection configuration will be pinged.
The server passed does not necessarily need to be a member of your cluster. Only the connection details (scheme, port, …) will be used to determine the exact url to send the ping request to.
Executes a reading query.
See Instream.Connection.execute/2
and Instream.Data.Read.query/2
for a complete list of available options.
Specs
status(opts :: Keyword.t) :: :ok | :error
Checks the status of a connection (= cluster).
Specs
write(payload :: map | [map], opts :: Keyword.t) :: any
Executes a writing query.
See Instream.Connection.execute/2
and Instream.Data.Write.query/2
for a complete list of available options.