Skip to content

Add correct pagination for filters #335

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hkdeman
Copy link
Contributor

@hkdeman hkdeman commented Jan 28, 2025

Fix: #281

Add total count for filter query to ensure that the pagination is correct.

Postgres Demo (shows filters has 3 pages with 15 total count on the filter):
image


countQuery := fmt.Sprintf("SELECT COUNT(*) %v", baseQuery)
var totalCount int
err = db.Raw(countQuery).Scan(&totalCount).Error

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources High

This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.

countQuery := fmt.Sprintf("SELECT COUNT(*) %v", baseQuery)
var totalCount int
err = db.Raw(countQuery).Scan(&totalCount).Error

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources High

This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
This query depends on a
user-provided value
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Filter, number of pages stays the same
1 participant