pagination

package
v0.1.57 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package pagination implements the functions, types, and interfaces for the module.

Package pagination implements the functions, types, and interfaces for the module.

Package pagination implements the functions, types, and interfaces for the module.

Index

Constants

View Source
const (
	DefaultPage     = 1
	DefaultPageSize = 15
	MaxPage         = 100
	MaxPageSize     = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlRequest

type ControlRequest interface {
	OnlyCountGetter
	NoPagingGetter
}

type CurrentGetter

type CurrentGetter interface {
	GetCurrent() int32
}

CurrentGetter is the interface for getting the current page number.

type DataGetter

type DataGetter interface {
	GetData() any
}

DataGetter is the interface for getting the data.

type DataResponse

type DataResponse interface {
	TotalGetter
	DataGetter
	ExtraGetter
}

type ExtraGetter

type ExtraGetter interface {
	GetExtra() any
}

ExtraGetter is the interface for getting the extra data.

type FieldMaskGetter

type FieldMaskGetter interface {
	GetFieldMask() []string
}

FieldMaskGetter is the interface for getting the field mask.

type FilterRequest

type FilterRequest interface {
	OrderByGetter
	FieldMaskGetter
}

type Limiter

type Limiter struct {
	MaxPage         int32
	DefaultPage     int32
	MaxPageSize     int32
	DefaultPageSize int32
}

func DefaultLimiter

func DefaultLimiter() *Limiter

func NewLimiter

func NewLimiter(page, defaultPage, pageSize, defaultPageSize int32) *Limiter

func (Limiter) Current

func (obj Limiter) Current(in int32) int32

func (Limiter) PerPage

func (obj Limiter) PerPage(in int32) int32

type LimiterOption

type LimiterOption = func(*Limiter)

func WithDefaultPage

func WithDefaultPage(page int32) LimiterOption

func WithDefaultPageSize

func WithDefaultPageSize(size int32) LimiterOption

func WithMaxPage

func WithMaxPage(page int32) LimiterOption

func WithMaxPageSize

func WithMaxPageSize(size int32) LimiterOption

type NextPageTokenGetter

type NextPageTokenGetter interface {
	GetNextPageToken() string
}

NextPageTokenGetter is the interface for getting the next page token.

type NoPagingGetter

type NoPagingGetter interface {
	GetNoPaging() bool
}

NoPagingGetter is the interface for checking if no paging is needed.

type OnlyCountGetter

type OnlyCountGetter interface {
	GetOnlyCount() bool
}

OnlyCountGetter is the interface for checking if only count is needed.

type OrderByGetter

type OrderByGetter interface {
	GetOrderBy() []string
}

OrderByGetter is the interface for getting the order by fields.

type PageLimiter

type PageLimiter interface {
	Current(in int32) int32
	PerPage(in int32) int32
}

type PageRequest

type PageRequest interface {
	CurrentGetter
	PageSizeGetter
	PageTokenGetter
}

type PageResponse

type PageResponse interface {
	CurrentGetter
	PageSizeGetter
	NextPageTokenGetter
}

type PageSizeGetter

type PageSizeGetter interface {
	GetPageSize() int32
}

PageSizeGetter is the interface for getting the page size.

type PageTokenGetter

type PageTokenGetter interface {
	GetPageToken() string
}

PageTokenGetter is the interface for getting the page token.

type Requester

Requester is the request interface for the module.

type Responder

Responder is the response interface for the module.

type SuccessGetter

type SuccessGetter interface {
	GetSuccess() bool
}

SuccessGetter is the interface for getting the success status.

type TotalGetter

type TotalGetter interface {
	GetTotal() int32
}

TotalGetter is the interface for getting the total count.

type UnimplementedRequester

type UnimplementedRequester struct{}

UnimplementedRequester is a struct that implements the Requester interface with empty methods.

func (UnimplementedRequester) GetCurrent

func (u UnimplementedRequester) GetCurrent() int32

GetCurrent returns the current page number.

func (UnimplementedRequester) GetFieldMask

func (u UnimplementedRequester) GetFieldMask() []string

GetFieldMask returns the field mask.

func (UnimplementedRequester) GetNoPaging

func (u UnimplementedRequester) GetNoPaging() bool

GetNoPaging returns a boolean indicating whether to disable paging.

func (UnimplementedRequester) GetOnlyCount

func (u UnimplementedRequester) GetOnlyCount() bool

GetOnlyCount returns a boolean indicating whether to only return the count.

func (UnimplementedRequester) GetOrderBy

func (u UnimplementedRequester) GetOrderBy() []string

GetOrderBy returns the order by fields.

func (UnimplementedRequester) GetPageSize

func (u UnimplementedRequester) GetPageSize() int32

GetPageSize returns the page size.

func (UnimplementedRequester) GetPageToken

func (u UnimplementedRequester) GetPageToken() string

GetPageToken returns the page token.

type UnimplementedResponder

type UnimplementedResponder struct{}

UnimplementedResponder is a struct that implements the Responder interface with empty methods.

func (UnimplementedResponder) GetCurrent

func (u UnimplementedResponder) GetCurrent() int32

GetCurrent returns the current page number.

func (UnimplementedResponder) GetData

func (u UnimplementedResponder) GetData() any

GetData returns the data.

func (UnimplementedResponder) GetExtra

func (u UnimplementedResponder) GetExtra() any

GetExtra returns any extra data.

func (UnimplementedResponder) GetNextPageToken

func (u UnimplementedResponder) GetNextPageToken() string

GetNextPageToken returns the next page token.

func (UnimplementedResponder) GetPageSize

func (u UnimplementedResponder) GetPageSize() int32

GetPageSize returns the page size.

func (UnimplementedResponder) GetSuccess

func (u UnimplementedResponder) GetSuccess() bool

GetSuccess returns a boolean indicating whether the request was successful.

func (UnimplementedResponder) GetTotal

func (u UnimplementedResponder) GetTotal() int32

GetTotal returns the total number of items.

Jump to

Keyboard shortcuts

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