Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 1.32 KB

README.md

File metadata and controls

44 lines (27 loc) · 1.32 KB

Go coverage Go Report Card

📃 pagorminator

Gorm plugin to add pagination to your select queries

😍 How to install it

go get -u -v github.com/manuelarte/pagorminator

🎯 How to use it

DB.Use(pagorminator.PaGormMinator{})
var products []*Products
pageRequest, err := pagorminator.PageRequest(0, 10)
DB.Clauses(pageRequest).First(&products)

The plugin will calculate the total amount of elements so then the fields total amounts and total pages can be used too. The pagination starts at index 0. So if the total pages is 6, then the pagination index goes from 0 to 5.

🎓 Examples

Simple query with no filters (where clause)

Simple query with no filters (where clause)

Using where to filter

Unpaged query

🔗 Contact