Incant. Ecto
(incant v0.1.0)
Copy Markdown
Small Ecto helpers for application-owned Incant resource queries.
Applications retain ownership of filtering, joins, projections, and authorization. These helpers only apply normalized table sorting and exact offset pagination.
Summary
Functions
Counts, clamps, and applies exact offset pagination to a query.
Applies an allowlisted table sort with a deterministic tie-breaker.
Types
@type page() :: %{ page: pos_integer(), page_size: pos_integer(), total: non_neg_integer(), total_pages: pos_integer() }
Functions
@spec page(Ecto.Queryable.t(), module(), map()) :: {Ecto.Query.t(), page()}
Counts, clamps, and applies exact offset pagination to a query.
@spec sort(Ecto.Queryable.t(), map(), [atom()], keyword()) :: Ecto.Query.t()
Applies an allowlisted table sort with a deterministic tie-breaker.