-
Notifications
You must be signed in to change notification settings - Fork 41
feat(worfklows): Allow server side pagination and filtering for workflows #1512
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,3 +36,23 @@ message CursorPaginationRequest { | |
| (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED | ||
| ]; | ||
| } | ||
|
|
||
| // OffsetPaginationRequest is used to paginate the results | ||
| message OffsetPaginationRequest { | ||
| // The (zero-based) offset of the first item returned in the collection. | ||
| int32 page = 1 [(buf.validate.field).int32.gte = 1]; | ||
| // The maximum number of entries to return. If the value exceeds the maximum, then the maximum value will be used. | ||
| int32 page_size = 2 [(buf.validate.field).int32.gt = 0, (buf.validate.field).int32.lte = 100]; | ||
| } | ||
|
|
||
| // OffsetPaginationResponse is used to return the pagination information | ||
| message OffsetPaginationResponse { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. out of curiosity, is this a common response type for this kind of pagination?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on where you search there is a different response. It seems the most common pattern is:
I've additionally added the |
||
| // The current page number | ||
| int32 page = 1; | ||
| // The number of results per page | ||
| int32 page_size = 2; | ||
| // The total number of results | ||
| int32 total_count = 3; | ||
| // The total number of pages | ||
| int32 total_pages = 4; | ||
| } | ||
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 mandatory? why don't we have a default?
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 message itself is not required, only if you provide it. The only default values are in the biz layer. I can add the default values 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.
I have been searching and I couldn't find a way to specify a default value on proto3, apparently it was an option of proto2. I have found this resource https://stackoverflow.com/questions/33222551/why-are-there-no-custom-default-values-in-proto3
In any case, rest assure there are default values if the pagination is not provided a default pagination object is created: