pagination

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLimit = 20
View Source
const DefaultWindow = 5

Variables

This section is empty.

Functions

func Offset

func Offset(page, limit int) int

func PageFromRequest

func PageFromRequest(r *http.Request) int

func TotalPages

func TotalPages(totalItems, limit int) int

Types

type Page

type Page struct {
	Number    int
	URL       string
	IsCurrent bool
}

type View

type View struct {
	CurrentPage int
	TotalPages  int
	HasPrev     bool
	PrevPage    int
	PrevURL     string
	HasNext     bool
	NextPage    int
	NextURL     string
	Pages       []Page
}

func Build

func Build(r *http.Request, currentPage, totalPages int) *View

func BuildFromTotal

func BuildFromTotal(r *http.Request, totalItems, limit int) *View

func BuildWithWindow

func BuildWithWindow(r *http.Request, currentPage, totalPages, windowSize int) *View

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL