Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No total count included #2

Open
nicolas-martin opened this issue Nov 28, 2018 · 2 comments
Open

No total count included #2

nicolas-martin opened this issue Nov 28, 2018 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@nicolas-martin
Copy link

nicolas-martin commented Nov 28, 2018

For paging it's often convenient to get the total number of items without regards to the limit and offset.

It's not trivial to do so https://github.com/jinzhu/gorm/issues/1752

@vikyd
Copy link

vikyd commented Nov 29, 2018

+1 want total count returned

@hellokaton hellokaton added the enhancement New feature or request label Jan 24, 2019
@hellokaton hellokaton self-assigned this Jan 24, 2019
@AlexandreCassagne
Copy link

AlexandreCassagne commented May 16, 2020

Like this?

paginator := pagination.Paging(&pagination.Param{
		DB:      db.Where("uid = ?", uid),
		Page:    page,
		Limit:   pageSize,
		OrderBy: []string{"id desc"},
}, &results)

count := paginator.TotalRecord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants