Name: ecto_subscribe
Owner: xerions
Description: Ecto plugin for possibility to have generic subscription on data
Created: 2015-03-13 11:50:26.0
Updated: 2018-02-21 08:05:26.0
Pushed: 2015-04-17 11:10:37.0
Homepage: null
Size: 178
Language: Elixir
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
ecto_subscribe
allows to subscribe on change a model.
You can define your ecto
model and use subscribe
macro:
rt Ecto.Subscribe.Api
odule MyModel do
e Ecto.Model
bscribe(repo: MyRepo)
hema "user" do
field :name, :string
field :old, :integer
d
After this tell to the ecto_subscribe
about your repo
and subcribe on event with:
.Subscribe.init(MyRepo)
.Subscribe.Api.subscribe(MyRepo, MyModel, "old > 20", [adapter: Ecto.Subscribe.Adapter.Log actions: [:create]])
When any event will occur, ecto_subscribe
will write to log this.
ecto_subcribe
supports following adapters:
changeset
to the log;changeset
via rpc to the given node.ecto_subscribe
supports following actions:
If actions
option not given, subscription will be created for all three events.
For running unut tests execute:
ENV=pg mix test
or
ENV=mysql mix test