github.com/Bytom/bytom@v1.1.2-0.20210127130405-ae40204c0b09/api/page_util.go (about) 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 }