Riccardo started his career as an embedded developer, but switched to backend development as soon as he discovered Elixir.
He’s currently using the power of the BEAM to develop Astarte, an open source IoT Data Ingestion platform, and Edgehog, an open source fleet management solution.
On the community front, he’s one of the organizers of the Erlang, Elixir and Friends devroom at FOSDEM and the co-founder of the Elixir Meetup Padova.
Imagine you want to ask your API ““List all devices which are not located in Europe and are currently connected or are either tagged ‘maintenance’ or ‘retired’””. Expressing this kind of selection with query parameters quickly becomes unwieldy, and even a more structured query language like GraphQL can feel clunky to express this, especially if the target user is not a technical one.
Ideally, we’d want users to be able to write something like: (not attributes["”continent””] == ““EU””) and (connected or (““maintenance”” in tags or ““retired”” in tags))
In this talk I will show you how this can be achieved with the power of Elixir, NimbleParsec and Ecto.
We will use NimbleParsec to parse the domain-specific language into an Abstract Syntax Tree represented using Elixir structs, and then we will traverse that AST to produce a valid query using the power of Ecto dynamic queries.