OSDN Git Service

new repo
[bytom/vapor.git] / api / page_util.go
1 package api
2
3 // Get the start and end of the page.
4 func getPageRange(size int, from uint, count uint) (uint, uint) {
5         total := uint(size)
6         if from == 0 && count == 0 {
7                 return 0, total
8         }
9         start := from
10         end := from + count
11         if start > total {
12                 start = total
13         }
14         if end > total {
15                 end = total
16         }
17         return start, end
18 }