paginations

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPagination

func CheckPagination(p *Pagination) error

CheckPagination checks if the given pagination is valid

Types

type Pagination

type Pagination struct {
	Limit      int
	Offset     int
	PageNumber int
	PageSize   int

	UseTotal bool
	Total    int
	// contains filtered or unexported fields
}

Pagination is a struct that keeps variables used to paginate the result

func NewFromConfig

func NewFromConfig(p *config.Pagination) *Pagination

NewFromConfig creates new pagination based on the provided config

func (*Pagination) Check

func (p *Pagination) Check() error

Check checks if the given pagination is valid

func (*Pagination) GetLimitOffset

func (p *Pagination) GetLimitOffset() (limit, offset int)

GetLimitOffset gets the limit and offset values from the given pagination

func (*Pagination) SetType

func (p *Pagination) SetType(tp Type)

SetType sets the pagination type

func (*Pagination) String

func (p *Pagination) String() string

String implements Stringer interface

func (*Pagination) Type

func (p *Pagination) Type() Type

Type gets the pagination type

type Parameter

type Parameter int

Parameter Defines the given paginate paramater type

const (
	ParamLimit Parameter = iota
	ParamOffset
	ParamNumber
	ParamSize
)

Parameter enum definition

type Type

type Type int

Type is the pagination type definition enum

const (
	TpOffset Type = iota
	TpPage
	TpCursor
)

Enum defined for the scope's pagination

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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