Yggdrasil for PostgreSQL v5.0.0 Yggdrasil.Adapter.Postgres View Source
Yggdrasil adapter for PostgreSQL. The name of the channel must be a string e.g:
Subscription to channel:
iex(2)> channel = %Yggdrasil.Channel{
iex(2)> name: "my_channel",
iex(2)> adapter: :postgres
iex(2)> }
iex(3)> Yggdrasil.subscribe(channel)
:ok
iex(4)> flush()
{:Y_CONNECTED, %Yggdrasil.Channel{name: "my_channel", (...)}}
Publishing message:
iex(5)> Yggdrasil.publish(channel, "foo")
:ok
Subscriber receiving message:
iex(6)> flush()
{:Y_EVENT, %Yggdrasil.Channel{name: "my_channel", (...)}, "foo"}
The subscriber can also unsubscribe from the channel:
iex(7)> Yggdrasil.unsubscribe(channel)
:ok
iex(8)> flush()
{:Y_DISCONNECTED, %Yggdrasil.Channel{name: "my_channel", (...)}}
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Gets default backend.
Gets publisher module.
Gets publisher module only if the given module exists.
Gets subscriber module.
Gets subscriber module only if the given module exists.
Gets default transformer.
Registers adapter in Registry
.
Start task to register the adapter in the Registry
.
Link to this section Functions
child_spec(arg) View Source
Returns a specification to start this module under a supervisor.
arg
is passed as the argument to Task.start_link/1
in the :start
field
of the spec.
For more information, see the Supervisor
module,
the Supervisor.child_spec/2
function and the Supervisor.child_spec/0
type.
get_backend()
View Source
get_backend() :: atom()
get_backend() :: atom()
Gets default backend.
get_publisher_module() View Source
Gets publisher module.
get_publisher_module(module) View Source
Gets publisher module only if the given module exists.
get_subscriber_module() View Source
Gets subscriber module.
get_subscriber_module(module) View Source
Gets subscriber module only if the given module exists.
get_transformer()
View Source
get_transformer() :: atom()
get_transformer() :: atom()
Gets default transformer.
register()
View Source
register() :: :ok
register() :: :ok
Registers adapter in Registry
.
start_link(_) View Source
Start task to register the adapter in the Registry
.