pagination

package
v0.0.0-...-c937b9e Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLimitName    = "limit"
	DefaultSkipName     = "skip"
	DefaultLimitDefault = 20
	DefaultLimitMax     = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Count    int    `json:"count"`
	Next     string `json:"next"`
	Previous string `json:"previous"`
}

type Paginator

type Paginator struct {
	LimitName    string
	SkipName     string
	LimitDefault int
	LimitMax     int
	Host         string // if there is no host, then url for previous and next will be relative
}

func New

func New() *Paginator

func (*Paginator) LimitParam

func (p *Paginator) LimitParam() *restful.Parameter

func (*Paginator) NextUrl

func (p *Paginator) NextUrl(req *restful.Request) string

func (*Paginator) Parse

func (p *Paginator) Parse(req *restful.Request) (skip, limit int)

func (*Paginator) ParseLimit

func (p *Paginator) ParseLimit(req *restful.Request) int

parse request and return limit

func (*Paginator) ParseSkip

func (p *Paginator) ParseSkip(req *restful.Request) int

parse request and return skip

func (*Paginator) PreviousUrl

func (p *Paginator) PreviousUrl(req *restful.Request) string

func (*Paginator) SkipParam

func (p *Paginator) SkipParam() *restful.Parameter

func (*Paginator) Urls

func (p *Paginator) Urls(req *restful.Request, skip, limit, count int) (previous, next string)

Jump to

Keyboard shortcuts

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