Documentation
¶
Overview ¶
Package pagination is the one page shape of every module List.
Order rule: each module owns one order, used by both API surfaces. History (Broadcasts, Automations runs, events) lists newest first, by id descending; catalogues (Templates, Segments, Tags, ...) list ascending by id.
Index ¶
Constants ¶
const DefaultPage = 1
DefaultPage and DefaultPageSize are what a module caller without a request gets. The contract (PageQuery) declares the same defaults and the page size maximum, which ogen enforces before a handler runs.
const DefaultPageSize = 25
DefaultPageSize is the fallback for module callers that have no request. contract-copy: the contract declares the same default
Variables ¶
This section is empty.
Functions ¶
func TotalPages ¶
Types ¶
type Page ¶
type Page[T any] struct { Items []T `json:"items"` Page int `json:"page"` PageSize int `json:"pageSize"` TotalItems int `json:"totalItems"` TotalPages int `json:"totalPages"` }
func List ¶
func List[T any]( ctx context.Context, p Params, count func(context.Context) (int, error), fetch func(ctx context.Context, limit, offset int) ([]T, error), ) (Page[T], error)
List builds one page from two closures: the total count, and the rows for a limit and offset. Ent builders share no interface, hence closures. Items is never nil.