Singyeong.Query (singyeong v0.4.14) View Source

Link to this section Summary

Functions

Merge the given ops into this query

Creates a new query for the given target application

Converts the provided values into a proper boolean op.

Adds the provided logical op over the provided ops to the query.

Adds the provided boolean op to the query.

Adds the provided boolean op to the query.

Sets the query's selector to the specified key

Link to this section Types

Specs

boolean_op() :: %{required(boolean_op_name()) => term()}

Specs

boolean_op_name() ::
  :"$eq"
  | :"$ne"
  | :"$gt"
  | :"$gte"
  | :"$lt"
  | :"$lte"
  | :"$in"
  | :"$nin"
  | :"$contains"
  | :"$ncontains"

Specs

logical_op() :: %{
  required(logical_op_name()) => maybe_improper_list(boolean_op(), logical_op())
}

Specs

logical_op_name() :: :"$and" | :"$or" | :"$nor"

Specs

op() :: %{required(binary()) => boolean_op() | logical_op()}

Specs

ops() :: [op()] | []

Specs

selector() :: :"$min" | :"$max" | :"$avg"

Specs

t() :: %Singyeong.Query{
  application: (String.t() | nil) | nil,
  droppable: boolean(),
  key: String.t() | nil,
  ops: [op()],
  optional: boolean(),
  restricted: boolean(),
  selector: selector() | nil
}

Link to this section Functions

Specs

merge(t(), [op()]) :: t()

Merge the given ops into this query

Specs

new(String.t() | nil) :: t()

Creates a new query for the given target application

Link to this function

values_to_op(op, key, value)

View Source

Specs

values_to_op(boolean_op_name(), String.t(), term()) :: boolean_op()

Converts the provided values into a proper boolean op.

Link to this function

with_logical_op(query, logical_op, op1, op2)

View Source

Specs

with_logical_op(t(), logical_op_name(), op(), op()) :: t()

Adds the provided logical op over the provided ops to the query.

Specs

with_op(t(), boolean_op()) :: t()

Adds the provided boolean op to the query.

Link to this function

with_op(query, op, key, value)

View Source

Specs

with_op(t(), boolean_op_name(), String.t(), term()) :: t()

Adds the provided boolean op to the query.

Link to this function

with_selector(query, selector, key)

View Source

Specs

with_selector(t(), selector(), String.t()) :: t()

Sets the query's selector to the specified key