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
refactor: Start DRY'ing filtered paginate code #16099
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a5b152f
Start DRY'ing filtered paginate code
ValarDragon c26c271
Move conditional
ValarDragon 338f416
Dedup core loop
ValarDragon 652d9d2
delete unnecessary var eliminates
ValarDragon 2100a7a
Revert "delete unnecessary var eliminates"
ValarDragon 7789983
Revert "Dedup core loop"
ValarDragon 0f46b6a
Revert "Move conditional"
ValarDragon a3a998d
de-dup a smaller set of loop
ValarDragon 517b3f8
Add a common PageRequest cleanupFn
ValarDragon 8d42944
Merge branch 'main' into dev/filtered_paginate_cleanup
ValarDragon fd317f9
Apply same dedup to generic paginate
ValarDragon cab4b23
Apply same ideas to main paginate query
ValarDragon 4c767e4
One more paginate instance cleanup
ValarDragon 8478446
Make Jacob happy (aka gofumpt)
ValarDragon e0971e2
Update types/query/pagination.go
ValarDragon 1e64cd2
Apply code comment defaults
ValarDragon abfde46
Fix linter typo
ValarDragon File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I got this wrong right here, because it looks at
iterator.Key()
. (Which is a different value in this loop)This is a bit annoying to make consistent with the old behavior. Will adjust the de-duplicated loop to get this consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically the old behavior would ideally worked with
numHits = end
right here.But it actually made nextKey skip to the next hit, which is kind of annoying to get to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current PR has this problem fixed.
In a later breaking release when redesigning the Filtered paginate, I would recommend changing this behavior. (As it will both be more correct from a performance expectation perspective, and code quality cleanup. We could delete all the extra for loops everywhere.)
However this PR is fully non-breaking.