MCPcopy Create free account
hub / github.com/apache/answer / ValPageOutOfRange

Function ValPageOutOfRange

internal/base/pager/pagination.go:67–76  ·  view source on GitHub ↗

ValPageOutOfRange validate page out of range

(total int64, page, pageSize int)

Source from the content-addressed store, hash-verified

65
66// ValPageOutOfRange validate page out of range
67func ValPageOutOfRange(total int64, page, pageSize int) bool {
68 if total <= 0 {
69 return false
70 }
71 if pageSize <= 0 {
72 return true
73 }
74 totalPages := (total + int64(pageSize) - 1) / int64(pageSize)
75 return page < 1 || page > int(totalPages)
76}

Callers 5

GetTagWithPageMethod · 0.92
QuestionPageMethod · 0.92
IndexMethod · 0.92
QuestionListMethod · 0.92
TagListMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected