Documentation
¶
Overview ¶
package cursor provides implementions of the pagintion.Options and pagination.Results interfaces for use with cursor or token-based pagination.
Index ¶
- Constants
- func CursorFromOptions(opts pagination.Options) string
- func NewCursorOptions() (pagination.Options, error)
- func NewPaginationFromCursors(previous string, next string) (pagination.Results, error)
- func NextCursor(r pagination.Results) string
- func PreviousCursor(r pagination.Results) string
- type CursorOptions
- func (opts *CursorOptions) Column(args ...string) string
- func (opts *CursorOptions) Method() pagination.Method
- func (opts *CursorOptions) Page(args ...int64) int64
- func (opts *CursorOptions) PerPage(args ...int64) int64
- func (opts *CursorOptions) Pointer(args ...interface{}) interface{}
- func (opts *CursorOptions) Spill(args ...int64) int64
- type CursorResults
- func (p *CursorResults) Method() pagination.Method
- func (p *CursorResults) Next() interface{}
- func (p *CursorResults) NextURL(t *uritemplates.UriTemplate) (string, error)
- func (p *CursorResults) Page() int64
- func (p *CursorResults) Pages() int64
- func (p *CursorResults) PerPage() int64
- func (p *CursorResults) Previous() interface{}
- func (p *CursorResults) PreviousURL(t *uritemplates.UriTemplate) (string, error)
- func (p *CursorResults) Total() int64
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 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 (p *CursorResults) NextURL(t *uritemplates.UriTemplate) (string, error)
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
Click to show internal directories.
Click to hide internal directories.