Lotus.Query.Sort (Lotus v0.16.4)

Copy Markdown View Source

Represents a sort directive to apply on query results.

Sorts are source-agnostic data structures that describe a column-level ordering. Each source adapter knows how to translate sorts into its native query language (e.g., SQL ORDER BY clauses).

Examples

%Sort{column: "created_at", direction: :desc}
%Sort{column: "name", direction: :asc}

Summary

Functions

Returns a human-readable label for the given direction.

Returns the list of valid direction atoms.

Creates a new sort, validating the direction.

Types

direction()

@type direction() :: :asc | :desc

t()

@type t() :: %Lotus.Query.Sort{column: String.t(), direction: direction()}

Functions

direction_label(atom)

@spec direction_label(direction()) :: String.t()

Returns a human-readable label for the given direction.

directions()

@spec directions() :: [direction(), ...]

Returns the list of valid direction atoms.

new(column, direction)

@spec new(String.t(), direction()) :: t()

Creates a new sort, validating the direction.