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

Redesign Paginate API #223

Open
si3nloong opened this issue Feb 5, 2023 · 0 comments
Open

Redesign Paginate API #223

si3nloong opened this issue Feb 5, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@si3nloong
Copy link
Owner

si3nloong commented Feb 5, 2023

The current Paginate API is quite frustrating, it's not user-friendly at all, especially when we use it for GraphQL, a lot of boilerplate codes. Suggesting converting it to iteration basic.

Proposed API :

result, err := db.Paginate(ctx, actions.Paginate())
if err != nil {
   panic(err)
}

result.StartCursor()
result.EndCursor()
result.ForEach(func(v T) {})
result.HasNext()
result.HasPrev()
result.Before(ctx, cursor)
result.After(ctx, cursor)
@si3nloong si3nloong self-assigned this Feb 5, 2023
@si3nloong si3nloong added the enhancement New feature or request label Feb 5, 2023
@si3nloong si3nloong added this to the Version 2 milestone Feb 5, 2023
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

1 participant