cursor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: BSD-3-Clause Imports: 3 Imported by: 5

Documentation

Overview

package cursor provides implementions of the pagintion.Options and pagination.Results interfaces for use with cursor or token-based pagination.

Index

Constants

View Source
const PAGE int64 = 1
View Source
const PER_PAGE int64 = 10
View Source
const SPILL int64 = 2

Variables

This section is empty.

Functions

func CursorFromOptions

func CursorFromOptions(opts pagination.Options) string

func NewCursorOptions

func NewCursorOptions() (pagination.Options, error)

func NewPaginationFromCursors

func NewPaginationFromCursors(previous string, next string) (pagination.Results, error)

func NextCursor

func NextCursor(r pagination.Results) string

func PreviousCursor

func PreviousCursor(r pagination.Results) string

Types

type CursorOptions

type CursorOptions struct {
	pagination.Options
	// contains filtered or unexported fields
}

func (*CursorOptions) Column

func (opts *CursorOptions) Column(args ...string) string

func (*CursorOptions) Method

func (opts *CursorOptions) Method() pagination.Method

func (*CursorOptions) Page

func (opts *CursorOptions) Page(args ...int64) int64

func (*CursorOptions) PerPage added in v0.1.2

func (opts *CursorOptions) PerPage(args ...int64) int64

func (*CursorOptions) Pointer

func (opts *CursorOptions) Pointer(args ...interface{}) interface{}

func (*CursorOptions) Spill

func (opts *CursorOptions) Spill(args ...int64) int64

type CursorResults

type CursorResults struct {
	pagination.Results `json:",omitempty"`
	TotalCount         int64  `json:"total"`
	PerPageCount       int64  `json:"per_page"`
	PageCount          int64  `json:"page"`
	NextPageURI        int64  `json:"next_page"`
	PreviousPageURI    int64  `json:"previous_page"`
	CursorNext         string `json:"next_cursor"`
	CursorPrevious     string `json:"previous_cursor"`
}

type CursorResults implements the pagination.Results interface for cursor or token-based pagination.

func (*CursorResults) Method

func (p *CursorResults) Method() pagination.Method

func (*CursorResults) Next

func (p *CursorResults) Next() interface{}

func (*CursorResults) NextURL

func (*CursorResults) Page

func (p *CursorResults) Page() int64

func (*CursorResults) Pages

func (p *CursorResults) Pages() int64

func (*CursorResults) PerPage

func (p *CursorResults) PerPage() int64

func (*CursorResults) Previous

func (p *CursorResults) Previous() interface{}

func (*CursorResults) PreviousURL

func (p *CursorResults) PreviousURL(t *uritemplates.UriTemplate) (string, error)

func (*CursorResults) Total

func (p *CursorResults) Total() int64

Jump to

Keyboard shortcuts

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