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

feat: add additional column ordering to keysetpagination #640

Merged
merged 11 commits into from
Dec 1, 2022

Conversation

jonas-jonas
Copy link
Member

cc @zepatrik

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

Copy link
Member

@zepatrik zepatrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this already looks very good 👍
Should we maybe allow multiple additional fields? We might not use it, but then it will be easy to do once it comes up.

pagination/keysetpagination/paginator.go Outdated Show resolved Hide resolved
pagination/keysetpagination/paginator.go Outdated Show resolved Hide resolved
@jonas-jonas
Copy link
Member Author

@zepatrik I'd like to postpone the support for multiple fields for now. I've spent too much time on this already, and that would just complicate it, IMO. I'll add some more tests, but then it should be good to go.

@jonas-jonas jonas-jonas marked this pull request as ready for review November 29, 2022 16:15
@jonas-jonas jonas-jonas marked this pull request as draft November 30, 2022 10:13
@jonas-jonas jonas-jonas marked this pull request as ready for review November 30, 2022 11:42
var _ PageTokenConstructor = NewMapPageToken
var _ PageTokenConstructor = NewStringPageToken

type PageTokenConstructor func(string) (PageToken, error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type PageTokenConstructor func(string) (PageToken, error)
type PageTokenConstructor = func(string) (PageToken, error)

A type alias allows to just pass a value without ever needing to do type assertions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice. Don't think this changes much in the current PR. Or did you have something specific in mind?

pagination/keysetpagination/page_token.go Outdated Show resolved Hide resolved
pagination/keysetpagination/header.go Show resolved Hide resolved
pagination/keysetpagination/header_test.go Outdated Show resolved Hide resolved
pagination/keysetpagination/header_test.go Outdated Show resolved Hide resolved
Copy link
Member

@zepatrik zepatrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 🎉

@zepatrik zepatrik merged commit d608f03 into master Dec 1, 2022
@zepatrik zepatrik deleted the feat/addOrderingToKeysetPagination branch December 1, 2022 16:22
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.

2 participants