You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to compile my first project with WalEx. So I created a small project to test the lib and I got the following compilation error: invalid quoted expression: %{}
I used this code :
defmodule MyOwnApp.Events.Users do
use WalEx.Event, name: MyOwnApp
# any subscribed event
on_event(:all, fn events ->
IO.inspect(events: events)
end)
# any user event
on_event(:users, fn users ->
IO.inspect(on_event: users)
# do something with users data
end)
# any user insert event
on_insert(:users, fn users ->
IO.inspect(on_insert: users)
end)
on_update(:users, fn users ->
IO.inspect(on_update: users)
end)
on_delete(:users, fn users ->
IO.inspect(on_delete: users)
end)
end
And I'm using the version 4 of WalEx.
Any idea? I'm a bit rusted with Elixir macros 😅
The text was updated successfully, but these errors were encountered:
It was because I was using the default value of the filters parameter (of the on_event macro), which is %{}. This value, when in the macro, is still %{} and cannot be unquoted (This is the exception I got).
I tried to escape it with Macro.escape before unquoting it and it worked, but then it stopped working when I passed a value to the filters parameter of the macro (not using the default value).
In this case, the unquoted value of the parameter was {:%{}, [], []}, which was not correct.
I don't know how to make defautl parameter value and explicit value work at the same time with macros.
So I didn't change the code and put %{} explicitly as value for the filters parameter of the on_event macro. It works like that (but not if I use the default value)
I also noticed another issue, with the replication slot this time.
When I do not manually set the slot_name config parameter, one is generated.
But the generated name uses forbidden characters (like dot '.').
Thus the query fails.
To solve this issue I explicitly set the slot_name config parameter value myself.
Hi,
I'm trying to compile my first project with WalEx. So I created a small project to test the lib and I got the following compilation error:
invalid quoted expression: %{}
I used this code :
And I'm using the version 4 of WalEx.
Any idea? I'm a bit rusted with Elixir macros 😅
The text was updated successfully, but these errors were encountered: