-
Notifications
You must be signed in to change notification settings - Fork 1
/
util.proto
50 lines (42 loc) · 1.91 KB
/
util.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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.
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.
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/
// 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. 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;
}
enum SortOrder {
ALPHABETICAL_ASCENDING = 0; // A-Z
ALPHABETICAL_DESCENDING = 1; // Z-A
DATE_ASCENDING = 2; // Oldest first
DATE_DESCENDING = 3; // Newest first
}