An open API service indexing awesome lists of open source software.

https://github.com/ilgooz/paging

Pagination Utils for Go
https://github.com/ilgooz/paging

Last synced: about 2 months ago
JSON representation

Pagination Utils for Go

Awesome Lists containing this project

README

        

### paging [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](http://godoc.org/github.com/ilgooz/paging)
> Simple pagination calculation util for Go

## Example
```go
func main(){
var page, limit, itemsCount = 2, 3, 5

p := paging.Paging{
Page: page,
Limit: limit,
Count: itemsCount,
}.Calc()

fmt.Println(p.Limit, p.Offset, p.Page, p.TotalPages) // 3, 3, 2, 2
}
```