Created
August 7, 2017 14:08
-
-
Save jde/1ad67b506669ae48d79a078efa407768 to your computer and use it in GitHub Desktop.
Pagination Pseudocode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### | |
# Interfaces describing the two kinds of cursor based paginated inputs | |
##### | |
interface TimePaginator { | |
Cursor Date.Time | |
} | |
interface SkipLimitPaginator { | |
Skip int | |
Limit int | |
} | |
##### | |
# Types to capture pagination input | |
##### | |
type TimePaginationInput { | |
Cursor Date.Time # Start before or after this timestamp depending on | |
Limit int # Limit the number of results to be returned. | |
Sort string # Default: CHRONOLOGICAL, accepts REVERSE_CHRONOLOGICAL | |
} | |
type SkipLimitPaginationInput { | |
Skip int # Start before or after this timestamp depending on | |
Limit int # Limit the number of results to be returned. | |
Sort string # Default: CHRONOLOGICAL, accepts REVERSE_CHRONOLOGICAL | |
} | |
##### | |
# Examples | |
##### | |
# Comment by articles will probably be a time based query since: | |
# comments are constantly coming in | |
# users are expecting the "next" comments | |
type CommentsByArticleInput { | |
TimePaginationInput | |
ArticleID int # Article to search on | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment