paginate

package
v0.0.0-...-d408576 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPageSize          = int32(500)
	DefaultPageSize      = MaxPageSize
	PageSizeQueryParam   = "page_size"
	PageCursorQueryParam = "page_cursor"
)

Variables

This section is empty.

Functions

func Paginate

func Paginate[T any, C comparable](c echo.Context, config Config[T, C]) ([]T, string, error)

Types

type Config

type Config[T any, C comparable] struct {
	CursorParser CursorParserFunc[C]
	CursorGetter CursorGetterFunc[T]
	Lister       ListFunc[T, C]
}

type CursorGetterFunc

type CursorGetterFunc[T any] func(item T) string

type CursorParserFunc

type CursorParserFunc[C comparable] func(rawCursor string) (*C, error)

func IDCursorParser

func IDCursorParser[ID id.ID, PT id.SubtypePtr[ID]]() CursorParserFunc[ID]

func Int64CursorParser

func Int64CursorParser() CursorParserFunc[int64]

type ListFunc

type ListFunc[T any, C comparable] func(filter PageFilter[C]) ([]T, error)

type PageFilter

type PageFilter[C comparable] struct {
	Size   int32
	Cursor *C
}

Jump to

Keyboard shortcuts

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