amqp-filter is an Erlang library that allows to evaluate SQL-92 predicates in the same way as in Azure Service Bus.
It supports the BNF grammar specified here.
To create the lexer and parser we have used leex and yecc
amqp_filter:evaluate("ID IN (123, 456, 789)", [{"ID", 456}]).
true
amqp_filter:evaluate("USERNAME = 'NICK' AND AGE > 18", [{ "USERNAME", "NICK" }, { "AGE", 25 }]).
true
amqp_filter:evaluate("YEAR % 4 = 0 AND (NOT YEAR % 100 = 0 OR YEAR % 400 = 0)", [{ "YEAR", 2018 }]).
false
amqp-filter is available as a Hex.pm package and uses Rebar 3 as its build system so it can be easily integrated in your project.
Adding amqp-filter as a package dependency in your rebar.config
file:
{deps, [{amqp_filter, "0.3.7"}]}.
Adding amqp-filter as a package dependency in your Makefile
:
DEPS = amqp_filter
dep_amqp_filter = hex 0.3.7
Adding amqp-filter as a package dependency in your mix.exs
file:
def project do
[
deps: [{:amqp_filter, "~> 0.3.7"}]
]
end
See https://hexdocs.pm/amqp_filter/ for a complete documentation.
It is recommended to build amqp-filter
on Linux.
- Download Erlang/OTP 20.x or later from Erlang Solutions
- Run
./build.sh