View Source EctoWatch (EctoWatch v0.9.1)
A library to allow you to easily get notifications about database changes directly from PostgreSQL.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for Supervisor.init/1.
Subscribe to notifications from watchers.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Callback implementation for Supervisor.init/1.
@spec subscribe(identifier(), term()) :: :ok | {:error, term()}
Subscribe to notifications from watchers.
Examples:
iex> EctoWatch.subscribe({Comment, :updated}) When subscribing to a watcher with the label option specified as :comment_updated_custom:
iex> EctoWatch.subscribe(:comment_updated_custom)You can subscribe to notifications just from specific primary key values:
iex> EctoWatch.subscribe({Comment, :updated}, user_id) Or you can subscribe to notifications just from a specific foreign column (**the column must be in the watcher's extra_columns list):
iex> EctoWatch.subscribe({Comment, :updated}, {:post_id, post_id})
This function is deprecated. subscribe/3 was removed in version 0.8.0. See the updated documentation.