MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / normalize

Method normalize

api/models/pagination.go:47–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45}
46
47func (p *Pagination) normalize() {
48 if p.Page <= 0 {
49 p.Page = 1
50 }
51 if p.Size <= 0 {
52 p.Size = p.defaultSize
53 }
54 if p.Total <= 0 {
55 p.Total = 0
56 }
57
58 p.Pages = int(math.Ceil(float64(p.Total) / float64(p.Size)))
59}
60
61// SetPage update current page index.
62func (p *Pagination) SetPage(page int) {

Callers 6

NewPaginationFunction · 0.95
SetPageMethod · 0.95
SetSizeMethod · 0.95
SetTotalMethod · 0.95
LimitMethod · 0.95
OffsetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected