Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Page ¶
type Page[T any, INT constraints.Unsigned] struct { PageNo INT `json:"pageNo"` // PageNo specifies the current page number (1-based). For custom JSON field naming, // use extra.SetNamingStrategy() from github.com/json-iterator/go. PageSize INT `json:"pageSize"` // PageSize indicates the number of items per page TotalPages INT `json:"totalPages"` // TotalPages holds the calculated total number of pages TotalRecords INT `json:"totalRecords"` // TotalRecords contains the complete count of dataset records Records []T `json:"records"` // Records stores the slice of items for the current page }
Page defines the pagination structure containing metadata and records
type Pager ¶
type Pager[T any, INT constraints.Unsigned] interface { AddRecords(records ...T) BuildDBPage() *db.Page[INT] BuildPage() *Page[T, INT] }
Pager defines the interface for pagination operations
func NewPager ¶
func NewPager[T any, INT constraints.Unsigned](pageNo, pageSize, totalRecords INT) Pager[T, INT]
NewPager constructs a paginator instance with sanitized input parameters
Parameters:
- pageNo: current page number (1-based index)
- pageSize: number of items per page
- totalRecords: total number of records
Returns a properly configured Pager instance
Click to show internal directories.
Click to hide internal directories.