evadne / etso

Ecto 3 adapter allowing use of Ecto schemas held in ETS tables
https://hexdocs.pm/etso
Apache License 2.0
377 stars 36 forks source link

Support null check is_nil #15

Closed rupurt closed 3 years ago

rupurt commented 3 years ago

Currently it raises the error

no function clause matching in Etso.ETS.MatchSpecification.build_condition/3

lib/etso/ets/match_specification.ex

  defmacrop guard_operator(:!=), do: :"/="
  defmacrop guard_operator(:<=), do: :"=<"
  defmacrop guard_operator(operator), do: operator
  for operator <- ~w(== != < > <= >= and or)a do
    defp build_condition(field_names, params, {unquote(operator), [], [lhs, rhs]}) do
      lhs_condition = build_condition(field_names, params, lhs)
      rhs_condition = build_condition(field_names, params, rhs)
      {guard_operator(unquote(operator)), lhs_condition, rhs_condition}
    end
  end

https://hexdocs.pm/ecto/Ecto.Query.API.html#is_nil/1

evadne commented 3 years ago

Indeed

evadne commented 3 years ago

Change merged in https://github.com/evadne/etso/pull/16 and 0.1.6 is on Hex 🆗