BlogEngine.Page (blog_engine v0.1.0)

Copy Markdown View Source

A transport-neutral page of BlogEngine records.

Summary

Functions

Builds a page from a fetched slice, its pagination inputs, and the total count.

Types

t(entry)

@type t(entry) :: %BlogEngine.Page{
  entries: [entry],
  has_next: boolean(),
  has_prev: boolean(),
  page: pos_integer(),
  per_page: pos_integer(),
  total_count: non_neg_integer(),
  total_pages: non_neg_integer()
}

Functions

new(entries, page, per_page, total_count, offset)

@spec new([entry], pos_integer(), pos_integer(), non_neg_integer(), non_neg_integer()) ::
  t(entry)
when entry: var

Builds a page from a fetched slice, its pagination inputs, and the total count.

offset is the zero-based index of the first requested entry, so a slice that stops short of total_count still reports a next page.