cpursley
Just added some DSL magic
to WalEx. WalEx allows you to listen to change events on your Postgres tables then perform callback-like actions with the data. It includes a diff of the data as well so that you can match on specific changes.
The codebase was originally based off of Supabase’s excellent realtime library which I then later refactored to use Postgrex’s new Replication capabilities. The reason I pulled it out into it’s own library is I wanted to work with the data directly in Elixir as well as track diffs.
So now you can set up an event listener like this:
defmodule MyApp.UserEvent do
use WalEx.Event, name: MyApp
# any event
on_event(:user, fn {:ok, user} ->
IO.inspect(on_event: user)
# do something with user data (Event Struct)
end)
on_insert(:user, fn {:ok, user} ->
IO.inspect(on_insert: user)
end)
on_update(:user, fn {:ok, user} ->
IO.inspect(on_update: user)
end)
on_delete(:user, fn {:ok, user} ->
IO.inspect(on_delete: user)
end)
I’m also considering adding a configuration-only option so that non-Elixir folks can use the library to listen to Postgres changes and send them wherever they need. Feedback and ideas on how I can improve WalEx is much appreciated!
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
cpursley
Now all end user needs to do is add their setting to a yaml config to send database change events to EventRelay (via WalEx): https://github.com/eventrelay/eventsql/blob/master/config.yaml