View Source ExtractQueryParams (extract_query_params v0.1.0)
Module for extracting query parameters from a list of keywords.
Summary
Functions
Turns list of keywords to SQL statement variables, connected with an operator (defaults to "AND").
Turns list of keywords to SQL statement variables, connected with an operator (defaults to "AND"). Raises an ArgumentError if the logical operator is not supported.
Functions
Turns list of keywords to SQL statement variables, connected with an operator (defaults to "AND").
Examples
iex> ExtractQueryParams.to_variables(foo: "bar")
{"foo = ?", ["bar"]}
Turns list of keywords to SQL statement variables, connected with an operator (defaults to "AND"). Raises an ArgumentError if the logical operator is not supported.
Examples
iex(1)> ExtractQueryParams.to_variables!([foo: "foo", bar: "bar"], "AND")
{"foo = ? AND bar = ?", ["foo", "bar"]}
iex(2)> ExtractQueryParams.to_variables!([foo: "foo", bar: "bar"], "UNSUPPORTED")
** (ArgumentError) logical operator "UNSUPPORTED" is not supported.