Skip to content

Commit

Permalink
Merge pull request #246 from overmindtech/update-pagination-docs
Browse files Browse the repository at this point in the history
Clarify docs
  • Loading branch information
dylanratcliffe authored Aug 13, 2024
2 parents 27fd773 + 3b0e0c3 commit caf8b7e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions util.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,32 @@ syntax = "proto3";
option go_package = "github.com/overmindtech/sdp-go;sdp";

message PaginationRequest {
// The number of items to return in a single page. The minimum is 10 and the maximum is 100.
// The number of items to return in a single page. The minimum is 10 and the
// maximum is 100.
int32 pageSize = 1;

// The page number to return. the first page is 1.
// if the page number is larger than the total number of pages, the last page is returned.
// if the page number is negative, the first page 1 is returned.
// The page number to return. the first page is 1. If the page number is
// larger than the total number of pages, the last page is returned. If the
// page number is negative, the first page 1 is returned.
int32 page = 2;
}

message PaginationResponse {
// The number of items in the current page
int32 pageSize = 1;

// The total number of items available. Expensive to calculate https://www.cybertec-postgresql.com/en/pagination-problem-total-result-count/
// The total number of items available. Expensive to calculate
// https://www.cybertec-postgresql.com/en/pagination-problem-total-result-count/
// this is done as a separate query
int32 totalItems = 2;

// The current page number, NB if the user provided a negative page number, this will be 1, if the user provided a page number larger than the total number of pages, this will be the last page.
// The current page number, NB if the user provided a negative page number,
// this will be 1, if the user provided a page number larger than the total
// number of pages, this will be the last page. If there are no results at
// all, this will be 0.
int32 page = 3;

// The total number of pages available. based on the totalItems and pageSize.
// If there are no results this will be zero.
int32 totalPages = 4;
}

0 comments on commit caf8b7e

Please sign in to comment.