pagination

package
v1.13.1-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Page     *int32 `json:"page,omitempty"`
	PageSize *int32 `json:"page_size,omitempty"`
}

Options can be used to supply pagination filter options to APIs.

type Paginator

type Paginator struct {
	DefaultPage     int32
	DefaultPageSize int32
	MaxPageSize     int32
}

Paginator handles common pagination workflows.

func NewPaginator

func NewPaginator(defaultPage int32, defaultPageSize int32, maxPageSize int32) Paginator

func (Paginator) NewPaginationOptions

func (p Paginator) NewPaginationOptions(page *int32, pageSize *int32) Options

func (Paginator) ValidatePaginationParams

func (p Paginator) ValidatePaginationParams(page *int32, pageSize *int32) error

type Paging

type Paging struct {
	Page  int32 `json:"page,omitempty"`
	Pages int32 `json:"pages,omitempty"`
	Total int32 `json:"total,omitempty"`
}

Paging can be used to capture paging information in API responses.

func ToPaging

func ToPaging(opts Options, count int) *Paging

Jump to

Keyboard shortcuts

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