Documentation ¶
Index ¶
- Constants
- Variables
- type Applier
- type Pagination
- func (p *Pagination) BuildQueryString(query url.Values, delKeys ...string) string
- func (p *Pagination) CleanQuery(query url.Values, delKeys ...string) url.Values
- func (p *Pagination) Data() echo.H
- func (p *Pagination) Get(key string) interface{}
- func (p *Pagination) HasNext() bool
- func (p *Pagination) HasPrev() bool
- func (p *Pagination) IsFirst() bool
- func (p *Pagination) IsLast() bool
- func (p *Pagination) IsPosition() bool
- func (p *Pagination) Limit() int
- func (p *Pagination) List(num ...int) []int
- func (p *Pagination) MarshalJSON() ([]byte, error)
- func (p *Pagination) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (p *Pagination) NextPage() int
- func (p *Pagination) NextPosition() string
- func (p *Pagination) Num() int
- func (p *Pagination) Offset() int
- func (p *Pagination) Options() echo.H
- func (p *Pagination) Page() int
- func (p *Pagination) Pages() int
- func (p *Pagination) Position() string
- func (p *Pagination) PrevPage() int
- func (p *Pagination) PrevPosition() string
- func (p *Pagination) RebuildQueryString(delKeys ...string) string
- func (p *Pagination) RebuildURL(pageVars map[string]string, delKeys ...string) string
- func (p *Pagination) Render(settings ...string) interface{}
- func (p *Pagination) Rows() int
- func (p *Pagination) Set(key string, data interface{}) *Pagination
- func (p *Pagination) SetAll(tmpl string, rows int, pageAndLinksAndSize ...int) *Pagination
- func (p *Pagination) SetLimit(limit int) *Pagination
- func (p *Pagination) SetNum(num int) *Pagination
- func (p *Pagination) SetOptions(m echo.H) *Pagination
- func (p *Pagination) SetPage(page int) *Pagination
- func (p *Pagination) SetPosition(prev string, next string, curr string) *Pagination
- func (p *Pagination) SetRows(rows int) *Pagination
- func (p *Pagination) SetSize(size int) *Pagination
- func (p *Pagination) SetTmpl(tmpl string) *Pagination
- func (p *Pagination) SetURL(s interface{}, delKeys ...string) *Pagination
- func (p *Pagination) Sets(args ...interface{}) *Pagination
- func (p *Pagination) Size() int
- func (p *Pagination) Tmpl() string
- func (p *Pagination) URL(curr interface{}) (s string)
- func (p *Pagination) UnmarshalJSON(b []byte) error
- func (p *Pagination) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
Constants ¶
View Source
const ( // ModePageNumber 页码模式 ModePageNumber = iota + 1 // ModePosition 偏移值模式 ModePosition )
View Source
const ( VarNamePage = `page` VarNameSize = `size` VarNameRows = `rows` VarNameOffsetCurrent = `curr` VarNameOffsetNext = `next` VarNameOffsetPrev = `prev` VarNameOffset = `offset` )
Variables ¶
View Source
var ( // DefaultPageVarsMap tagName=>urlVar DefaultPageVarsMap = echo.KVList{ {K: VarNamePage, V: VarNamePage}, {K: VarNameSize, V: VarNameSize}, {K: VarNameRows, V: VarNameRows}, } // DefaultPositionVarsMap tagName=>urlVar DefaultPositionVarsMap = echo.KVList{ {K: VarNameOffsetNext, V: VarNameOffsetNext}, {K: VarNameOffsetCurrent, V: VarNameOffset}, {K: VarNameOffsetPrev, V: VarNameOffsetPrev}, {K: VarNameSize, V: VarNameSize}, } )
Functions ¶
This section is empty.
Types ¶
type Applier ¶ added in v0.0.3
type Applier interface {
Apply(*Pagination)
}
type Pagination ¶
type Pagination struct {
// contains filtered or unexported fields
}
Pagination 分页
func (*Pagination) BuildQueryString ¶ added in v0.2.3
func (p *Pagination) BuildQueryString(query url.Values, delKeys ...string) string
func (*Pagination) CleanQuery ¶ added in v0.2.3
func (*Pagination) IsPosition ¶ added in v0.2.4
func (p *Pagination) IsPosition() bool
func (*Pagination) Limit ¶
func (p *Pagination) Limit() int
func (*Pagination) List ¶
func (p *Pagination) List(num ...int) []int
func (*Pagination) MarshalJSON ¶
func (p *Pagination) MarshalJSON() ([]byte, error)
MarshalJSON allows type Pagination to be used with json.Marshal
func (*Pagination) MarshalXML ¶
func (p *Pagination) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML allows type Pagination to be used with xml.Marshal
func (*Pagination) NextPage ¶
func (p *Pagination) NextPage() int
func (*Pagination) Num ¶
func (p *Pagination) Num() int
func (*Pagination) Offset ¶ added in v0.0.2
func (p *Pagination) Offset() int
func (*Pagination) Options ¶
func (p *Pagination) Options() echo.H
func (*Pagination) Page ¶
func (p *Pagination) Page() int
func (*Pagination) Pages ¶
func (p *Pagination) Pages() int
func (*Pagination) PrevPage ¶
func (p *Pagination) PrevPage() int
func (*Pagination) RebuildQueryString ¶
func (p *Pagination) RebuildQueryString(delKeys ...string) string
func (*Pagination) RebuildURL ¶
func (p *Pagination) RebuildURL(pageVars map[string]string, delKeys ...string) string
func (*Pagination) Render ¶
func (p *Pagination) Render(settings ...string) interface{}
func (*Pagination) Rows ¶
func (p *Pagination) Rows() int
func (*Pagination) Set ¶
func (p *Pagination) Set(key string, data interface{}) *Pagination
Set 设置附加数据
func (*Pagination) SetAll ¶
func (p *Pagination) SetAll(tmpl string, rows int, pageAndLinksAndSize ...int) *Pagination
SetAll 设置按页码分页模式所需的所有参数 tmpl 模板 rows 总行数 pageAndLinksAndSize[0] 当前页码 pageAndLinksAndSize[1] 分页链接数量 pageAndLinksAndSize[2] 每页数量
func (*Pagination) SetLimit ¶
func (p *Pagination) SetLimit(limit int) *Pagination
func (*Pagination) SetNum ¶
func (p *Pagination) SetNum(num int) *Pagination
func (*Pagination) SetOptions ¶
func (p *Pagination) SetOptions(m echo.H) *Pagination
func (*Pagination) SetPage ¶
func (p *Pagination) SetPage(page int) *Pagination
func (*Pagination) SetPosition ¶
func (p *Pagination) SetPosition(prev string, next string, curr string) *Pagination
SetPosition 设置按偏移值分页模式所需的所有参数 prev 上一页偏移值 next 下一页偏移值 curr 当前页偏移值
func (*Pagination) SetRows ¶
func (p *Pagination) SetRows(rows int) *Pagination
func (*Pagination) SetSize ¶
func (p *Pagination) SetSize(size int) *Pagination
SetSize SetLimit方法的别名
func (*Pagination) SetTmpl ¶
func (p *Pagination) SetTmpl(tmpl string) *Pagination
func (*Pagination) SetURL ¶
func (p *Pagination) SetURL(s interface{}, delKeys ...string) *Pagination
func (*Pagination) Sets ¶
func (p *Pagination) Sets(args ...interface{}) *Pagination
Sets 设置多个附加数据(参数按照key,value,key1,value1的格式)
func (*Pagination) Tmpl ¶
func (p *Pagination) Tmpl() string
func (*Pagination) URL ¶
func (p *Pagination) URL(curr interface{}) (s string)
func (*Pagination) UnmarshalJSON ¶ added in v0.0.3
func (p *Pagination) UnmarshalJSON(b []byte) error
func (*Pagination) UnmarshalXML ¶ added in v0.0.3
func (p *Pagination) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
Click to show internal directories.
Click to hide internal directories.