View Source Nested.QueryParser (Nestex v0.3.0)

Parser for converting query strings into path lists.

Implemented as a small recursive-descent scanner over the input binary (walking it via function-head pattern matching) rather than regular expressions — this avoids fragile lookaheads for things like "split on dots, but not the ones inside brackets".

Summary

Functions

Parse a query string into a path list.

Functions

Link to this function

parse(query_string, key_type \\ :atom)

View Source
@spec parse(String.t(), :atom | :string) :: list()

Parse a query string into a path list.

Examples

parse("users.0.name")              #=> [:users, 0, :name]
parse("users[name=Alice].age")     #=> [:users, %{name: "Alice"}, :age]
parse("users[*].name")             #=> [:users, "*", :name]