Q v1.0.0 Q View Source

Documentation for Q.

Link to this section Summary

Functions

Breaks the string in fragments and then puts the fragments into an accumulator. For example, "x:0 y:1" would become %{"x" => 0, "y" => 1}

Cuts the operator from the value.

Creates a catch_param function to catch the param when it matches one of the operators, or fallback to a default.

Iterates shards against a given function, usually catch_param.

Puts the value in the accumulator, creating a value+operator map. When there's no operator, the value can be put directly passing :put, or the ignored with :acc, which returns the accumulator as is.

Link to this section Functions

Specs

break_string(string :: String.t()) :: map()

Breaks the string in fragments and then puts the fragments into an accumulator. For example, "x:0 y:1" would become %{"x" => 0, "y" => 1}

Link to this function

cut_operator(value, operator)

View Source

Specs

cut_operator(value :: String.t(), operator :: String.t()) :: String.t()

Cuts the operator from the value.

Link to this function

match_operators(key, value, acc, operators, default)

View Source

Specs

match_operators(
  key :: String.t(),
  value :: String.t(),
  acc :: map(),
  operators :: [String.t()],
  default_mode :: :acc | :put
) :: map()
Link to this macro

param(param, key, operators, mode)

View Source (macro)

Creates a catch_param function to catch the param when it matches one of the operators, or fallback to a default.

Specs

parse_shards(shards :: map(), f :: (... -> any())) :: map()

Iterates shards against a given function, usually catch_param.

Link to this function

put_value(op, acc, key, value, arg5)

View Source

Specs

put_value(
  operator :: nil | String.t(),
  acc :: map(),
  key :: String.t(),
  value :: String.t(),
  mode :: :acc | :put
) :: map()

Puts the value in the accumulator, creating a value+operator map. When there's no operator, the value can be put directly passing :put, or the ignored with :acc, which returns the accumulator as is.