-
Notifications
You must be signed in to change notification settings - Fork 378
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(boards2): add pagination #3216
base: devx/feature/boardsv2
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
918cc79
to
0918c2e
Compare
pg := pager.NewPager(&board.threads, p.PageSize) | ||
page := pg.GetPage(p.PageNumber) |
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.
Is it not possible to use something like the following?
pg := pager.NewPager(&board.threads, p.PageSize) | |
page := pg.GetPage(p.PageNumber) | |
page := pager.NewPager(&board.threads, boardsPageSize).MustGetPageByPath(path) |
Where path is the render path. This would allow to remove the Pagination
struct.
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.
@jeronimoalbi the idea here is to have separation of concerns, so render.gno
which acts as a controller will be responsible for getting pagination query string information.
pg := pager.NewPager(&gBoardsByID, defaultPageSize) | ||
pageNum, limit, err := pg.ParseQuery(r.requestUri) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
page := pg.GetPageWithSize(pageNum, limit) |
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.
@x1unix what do you think about just using MustGetPageByPath
everywhere? Is there a constraint not to use it also here?
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.
@jeronimoalbi please check response above.
@x1unix let's not wrap the router, lets use it even if it doesn't support query string arguments. At this point is not a blocker as the listing will work, caveat is that only the first page for now. |
This PR adds pagination for boards and posts list using
p/demo/avl/pager
package.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the descriptionCC @jeronimoalbi