Paginator

package module
v0.0.0-...-42e8c1f Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: MIT Imports: 7 Imported by: 1

README

pagination

pagination golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PageSize    int
	Current     int
	LinkedCount int
	PageKey     string
	Request     *http.Request
}

Config

type Page

type Page struct {
	// contains filtered or unexported fields
}

Page

func (*Page) IsCurrent

func (p *Page) IsCurrent() bool

IsCurrent

func (*Page) Num

func (p *Page) Num() int

Num

type PageURL

type PageURL struct {
	*Page
	// contains filtered or unexported fields
}

PageURL The current page's data content

func (*PageURL) IsCurrent

func (p *PageURL) IsCurrent() bool

IsCurrent is the current page

func (*PageURL) Num

func (p *PageURL) Num() int

Num page number

func (*PageURL) Path

func (p *PageURL) Path() string

Path Current web path address

type Paginator

type Paginator struct {
	// contains filtered or unexported fields
}

Paginator

func Custom

func Custom(c *Config, total int) *Paginator

Пользовательские параметры по умолчанию

func New

func New(total int) *Paginator

New Paginator инициализировать с параметрами по умолчанию

func (*Paginator) Current

func (p *Paginator) Current() int

Current

func (*Paginator) CurrentURL

func (p *Paginator) CurrentURL() string

CurrentURL

func (*Paginator) FristURL

func (p *Paginator) FristURL() int

FristURL

func (*Paginator) HasNext

func (p *Paginator) HasNext() bool

HasNext

func (*Paginator) HasPrevious

func (p *Paginator) HasPrevious() bool

HasPrevious

func (*Paginator) IsFirst

func (p *Paginator) IsFirst() bool

IsFirst If the current page is the first page to return true

func (*Paginator) IsLast

func (p *Paginator) IsLast() bool

IsLast

func (*Paginator) LastURL

func (p *Paginator) LastURL() int

LastURL

func (*Paginator) Next

func (p *Paginator) Next() int

Next

func (*Paginator) NextURL

func (p *Paginator) NextURL() int

NextURL

func (*Paginator) PageSize

func (p *Paginator) PageSize() int

PageSize

func (*Paginator) PageTemp

func (p *Paginator) PageTemp() template.HTML

PageTemp Gets a page template for pagination results that can be loaded directly in html

func (*Paginator) PageURLs

func (p *Paginator) PageURLs() []*PageURL

PageURLs returns the page number and URL information of the current page.

func (*Paginator) Pages

func (p *Paginator) Pages() []*Page

Pages

func (*Paginator) Previous

func (p *Paginator) Previous() int

Previous

func (*Paginator) PreviousURL

func (p *Paginator) PreviousURL() int

PreviousURL

func (*Paginator) Request

func (p *Paginator) Request(r *http.Request) *Paginator

Request can initialize a network request parameter, such as a specified URL for the page, before calling the interface. If the interface is passed in the pageKey request parameter, the current page number will be updated according to the parameter content.

func (*Paginator) Total

func (p *Paginator) Total() int

Total

func (*Paginator) TotalPages

func (p *Paginator) TotalPages() int

TotalPages

type PaginatorRecords

type PaginatorRecords struct {
	TotalRecord int         `json:"total_record"`
	TotalPage   int         `json:"total_page"`
	Records     interface{} `json:"records"`
	Offset      int         `json:"offset"`
	Limit       int         `json:"limit"`
	Page        int         `json:"page"`
	PrevPage    int         `json:"prev_page"`
	NextPage    int         `json:"next_page"`
}

func Paging

func Paging(p *Param, result interface{}) *PaginatorRecords

type Param

type Param struct {
	DB      *gorm.DB
	Page    int
	Limit   int
	OrderBy []string
	ShowSQL bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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