MCPcopy Index your code
hub / github.com/upper/db / TotalPages

Method TotalPages

internal/sqlbuilder/paginate.go:128–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126}
127
128func (pag *paginator) TotalPages() (uint, error) {
129 pq, err := pag.build()
130 if err != nil {
131 return 0, err
132 }
133
134 count, err := pq.count()
135 if err != nil {
136 return 0, err
137 }
138 if count < 1 {
139 return 0, nil
140 }
141
142 if pq.pageSize < 1 {
143 return 1, nil
144 }
145
146 pages := uint(math.Ceil(float64(count) / float64(pq.pageSize)))
147 return pages, nil
148}
149
150func (pag *paginator) All(dest interface{}) error {
151 pq, err := pag.buildWithCursor()

Callers

nothing calls this directly

Calls 2

buildMethod · 0.95
countMethod · 0.45

Tested by

no test coverage detected