paginator

package
v0.1.119 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorFirstLastMissing = "you must provide a `first` or `last` value to properly paginate the objects"
	ErrorFirstLastInvalid = "you must provide a valid `first` or `last` value in range 1-100"
	ErrorCursorInvalid    = "cursor value is invalid"
)

Variables

This section is empty.

Functions

func CreateCursor

func CreateCursor(created uint64, object interface{}) string

func LogRequest

func LogRequest(prefix string, params *Params)

func ParseCursor

func ParseCursor(cursor string, object interface{}) (uint64, error)

func ValidateFirstAndLast

func ValidateFirstAndLast(first, last *int) (count int, valid bool, err error)

Types

type BatchInfo

type BatchInfo struct {
	Count  int
	Tail   bool
	Before uint64
	After  uint64
}

func Validate

func Validate(prefix string, params *Params) (info *BatchInfo, err error)

type Params

type Params struct {
	First  *int
	Last   *int
	Before *string
	After  *string
	Object interface{}
}

Jump to

Keyboard shortcuts

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