pagination

package
v1.0.0-beta.128 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 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 Page

type Page struct {
	PageSize   int `json:"pageSize"`
	PageNumber int `json:"page"`
}

func (Page) IsZero

func (p Page) IsZero() bool

func (Page) Limit

func (p Page) Limit() int

func (Page) Offset

func (p Page) Offset() int

type PagedResponse

type PagedResponse[T any] struct {
	Page       Page `json:"-"`
	TotalCount int  `json:"totalCount"`
	Items      []T  `json:"items"`
}

func (PagedResponse[T]) MarshalJSON

func (p PagedResponse[T]) MarshalJSON() ([]byte, error)

Implement json.Marshaler interface to flatten the Page struct

type Paginator

type Paginator[T any] interface {
	Paginate(ctx context.Context, page Page) (PagedResponse[T], error)
}

Jump to

Keyboard shortcuts

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