pagination

package
v0.0.0-...-35bba2d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CountDefault = 50
)

Variables

This section is empty.

Functions

func ParseCount

func ParseCount(ctx echo.Context) uint16

func ParseCursor

func ParseCursor(ctx echo.Context) ksuid.KSUID

func ParseReverse

func ParseReverse(ctx echo.Context) bool

func SetHeaders

func SetHeaders(ctx echo.Context, pgn *Pagination)

Types

type Pagination

type Pagination struct {
	Cursor     ksuid.KSUID `query:"cursor"`
	NextCursor ksuid.KSUID
	Count      uint16 `query:"count" validate:"min=1,max=1000"`
	Reverse    bool   `query:"reverse"`
}

func New

func New(ctx echo.Context) *Pagination

func (*Pagination) EndKey

func (pgn *Pagination) EndKey(cursor *bolt.Cursor) (ksuid.KSUID, error)

func (*Pagination) InitCursor

func (pgn *Pagination) InitCursor(cursor *bolt.Cursor) (key []byte, value []byte)

func (*Pagination) MoveCursor

func (pgn *Pagination) MoveCursor(cursor *bolt.Cursor) (key []byte, value []byte)

Jump to

Keyboard shortcuts

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