Lotus.Query.Filter (Lotus v0.16.4)

Copy Markdown View Source

Represents a filter condition to apply on query results.

Filters are source-agnostic data structures that describe a column-level predicate. Each source adapter knows how to translate filters into its native query language (e.g., SQL WHERE clauses via CTE wrapping).

Examples

%Filter{column: "region", op: :eq, value: "US"}
%Filter{column: "price", op: :gt, value: 100}
%Filter{column: "deleted_at", op: :is_null}

Summary

Functions

Creates a new filter, validating the operator.

Returns a human-readable label for the given operator.

Returns the list of valid operator atoms.

Types

operator()

@type operator() ::
  :eq | :neq | :gt | :lt | :gte | :lte | :like | :is_null | :is_not_null

t()

@type t() :: %Lotus.Query.Filter{column: String.t(), op: operator(), value: term()}

Functions

new(column, op, value \\ nil)

@spec new(String.t(), operator(), term()) :: t()

Creates a new filter, validating the operator.

operator_label(atom)

@spec operator_label(operator()) :: String.t()

Returns a human-readable label for the given operator.

operators()

@spec operators() :: [operator(), ...]

Returns the list of valid operator atoms.