countable

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: 4 Imported by: 13

Documentation

Overview

package countable provides implementions of the pagintion.Options and pagination.Results interfaces for use with page-based or numbered pagination.

Index

Constants

View Source
const COUNTABLE string = "*"
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 NewCountableOptions added in v0.1.1

func NewCountableOptions() (pagination.Options, error)

func NewResultsFromCount added in v0.1.1

func NewResultsFromCount(total_count int64) (pagination.Results, error)

NewResultsFromCount will return a new CountableResults instance for total_count using criteria defined in a default CountableOptions instance.

func NewResultsFromCountWithOptions added in v0.1.1

func NewResultsFromCountWithOptions(opts pagination.Options, total_count int64) (pagination.Results, error)

NewResultsFromCount will return a new CountableResults instance for total_count using criteria defined in opts.

func NextPage added in v0.1.1

func NextPage(r pagination.Results) int64

func PageFromOptions added in v0.1.1

func PageFromOptions(opts pagination.Options) int64

func PreviousPage added in v0.1.1

func PreviousPage(r pagination.Results) int64

Types

type CountableOptions added in v0.1.1

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

func (*CountableOptions) Column added in v0.1.1

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

func (*CountableOptions) Method added in v0.1.1

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

func (*CountableOptions) PerPage added in v0.1.1

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

func (*CountableOptions) Pointer added in v0.1.1

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

func (*CountableOptions) Spill added in v0.1.1

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

type CountableResults added in v0.1.1

type CountableResults struct {
	pagination.Results `json:",omitempty"`
	TotalCount         int64 `json:"total"`
	PerPageCount       int64 `json:"per_page"`
	PageCount          int64 `json:"page"`
	PagesCount         int64 `json:"pages"`
	NextPageURI        int64 `json:"next_page"`
	PreviousPageURI    int64 `json:"previous_page"`
}

type CountableResults implements the pagination.Results interface for page or number-based pagination.

func (*CountableResults) Method added in v0.1.1

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

func (*CountableResults) Next added in v0.1.1

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

func (*CountableResults) NextURL added in v0.1.1

NextURL returns URL to the next set of results in a query response.

func (*CountableResults) Page added in v0.1.1

func (p *CountableResults) Page() int64

func (*CountableResults) Pages added in v0.1.1

func (p *CountableResults) Pages() int64

func (*CountableResults) PerPage added in v0.1.1

func (p *CountableResults) PerPage() int64

func (*CountableResults) Previous added in v0.1.1

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

func (*CountableResults) PreviousURL added in v0.1.1

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

PreviousURL returns URL to the previous set of results in a query response.

func (*CountableResults) Total added in v0.1.1

func (p *CountableResults) Total() int64

Jump to

Keyboard shortcuts

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