EctoContext.Paginator (EctoContext v0.1.0)

Copy Markdown View Source

Pagination result struct containing entries, total count, and page metadata.

Returned by the paginate/2 function generated by EctoContext. Holds the current page's entries along with computed fields like total_pages, has_next_page?, and has_previous_page?.

Summary

Functions

Creates a new Paginator struct from query results.

Types

t()

@type t() :: %EctoContext.Paginator{
  entries: list(),
  has_next_page?: boolean(),
  has_previous_page?: boolean(),
  page: pos_integer(),
  per_page: pos_integer(),
  total: non_neg_integer(),
  total_pages: non_neg_integer()
}

Functions

new(entries, total, page, per_page)

@spec new(list(), non_neg_integer(), term(), term()) :: t()

Creates a new Paginator struct from query results.

Normalizes page and per_page (accepts integers or string integers) and computes total_pages, has_next_page?, and has_previous_page?.