We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Creating a Custom Query Language in Elixir with NimbleParsec and Ecto
263
clicks
Source: youtube.com
In R. Binetti's presentation, they demonstrate how to design a custom query language suitable for non-technical users to filter API data, such as listing devices based on multiple criteria like location and status tags. The talk showcases how Elixir's NimbleParsec library can be used to parse the DSL into an Abstract Syntax Tree (AST) comprised of Elixir structs. These structs are then processed with Ecto's dynamic queries to execute the user-defined filters effectively. R. Binetti emphasizes creating function-based parsers with NimbleParsec, where each function consumes and outputs text, eventually becoming part of an optimized parsing function without runtime dependencies. The presenter guides through the different stages of parsing literal strings, mapping strings to atoms, handling integer comparisons, ignoring unnecessary strings, and using combinators to control parser output. The discussion includes traversing the AST using Elixir's protocol and building an Ecto dynamic query matching the parsed language's structure, which offers the flexibility to extend the query functionality to perform in-memory filtering.
Related posts
© HashMerge 2024