LightningWeb.Live.AiAssistant.PaginationMeta (Lightning v2.14.5-pre1)
View SourcePagination metadata for AI Assistant sessions.
Handles offset-based pagination and infinite scroll patterns.
Summary
Functions
Calculates database offset for current page.
Checks if on first page.
Creates metadata for a specific page.
Checks if on last page.
Creates pagination metadata from current state.
Returns page numbers for navigation display.
Generates human-readable pagination summary.
Calculates total number of pages.
Types
@type t() :: %LightningWeb.Live.AiAssistant.PaginationMeta{ current_page: pos_integer(), has_next_page: boolean(), has_prev_page: boolean(), page_size: pos_integer(), total_count: non_neg_integer() }
Functions
@spec current_offset(t()) :: non_neg_integer()
Calculates database offset for current page.
Checks if on first page.
@spec for_page(t(), pos_integer()) :: t()
Creates metadata for a specific page.
Checks if on last page.
@spec new(non_neg_integer(), pos_integer(), non_neg_integer()) :: t()
Creates pagination metadata from current state.
Examples
iex> new(25, 20, 100)
%PaginationMeta{current_page: 2, page_size: 20, total_count: 100, has_next_page: true, has_prev_page: true}
@spec page_range(t(), pos_integer()) :: [pos_integer()]
Returns page numbers for navigation display.
Centers around current page with max visible pages.
Generates human-readable pagination summary.
Examples
iex> summary(%PaginationMeta{current_page: 2, page_size: 20, total_count: 45})
"Showing 21-40 of 45"
@spec total_pages(t()) :: pos_integer()
Calculates total number of pages.