View Source QueryParser.Parser (query_parser v1.0.0-beta.27)

This Parser module will use the grammar to parse the query string into an AST.

Summary

Functions

This function will take a valid mongo query and replace all param-ref (@foo.bar) to replace them with the corresponding value in the params map.

Functions

Link to this function

parse(query_str, params \\ %{})

View Source
@spec parse(String.t(), map()) :: {:ok, any()} | {:error, :invalid_query}
Link to this function

parse!(query_str, params \\ %{})

View Source
@spec parse!(String.t(), map()) :: map()
Link to this function

replace_params(map, params)

View Source
@spec replace_params(term(), map()) :: term()

This function will take a valid mongo query and replace all param-ref (@foo.bar) to replace them with the corresponding value in the params map.

ex:

Parser.replace_params(%{"foo" => "@me"}, %{"me" => "bar"}) %{"foo" => "bar"}