Documentation ¶
Overview ¶
package countable provides implementions of the pagintion.Options and pagination.Results interfaces for use with page-based or numbered pagination.
Index ¶
- Constants
- func NewCountableOptions() (pagination.Options, error)
- func NewResultsFromCount(total_count int64) (pagination.Results, error)
- func NewResultsFromCountWithOptions(opts pagination.Options, total_count int64) (pagination.Results, error)
- func NextPage(r pagination.Results) int64
- func PageFromOptions(opts pagination.Options) int64
- func PreviousPage(r pagination.Results) int64
- type CountableOptions
- func (opts *CountableOptions) Column(args ...string) string
- func (p *CountableOptions) Method() pagination.Method
- func (opts *CountableOptions) PerPage(args ...int64) int64
- func (opts *CountableOptions) Pointer(args ...interface{}) interface{}
- func (opts *CountableOptions) Spill(args ...int64) int64
- type CountableResults
- func (p *CountableResults) Method() pagination.Method
- func (p *CountableResults) Next() interface{}
- func (p *CountableResults) NextURL(t *uritemplates.UriTemplate) (string, error)
- func (p *CountableResults) Page() int64
- func (p *CountableResults) Pages() int64
- func (p *CountableResults) PerPage() int64
- func (p *CountableResults) Previous() interface{}
- func (p *CountableResults) PreviousURL(t *uritemplates.UriTemplate) (string, error)
- func (p *CountableResults) Total() int64
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
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 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
func (p *CountableResults) NextURL(t *uritemplates.UriTemplate) (string, error)
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
Click to show internal directories.
Click to hide internal directories.