-
Notifications
You must be signed in to change notification settings - Fork 8
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: handle cursor pagination #878
base: main
Are you sure you want to change the base?
Conversation
import Page, { PlainPage } from '../page'; | ||
import Sort, { PlainSortClause } from '../sort'; | ||
|
||
export type PaginationType = 'page' | 'cursor'; |
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.
🤝
export default class Cursor { | ||
before: string; | ||
after: string; | ||
limit: number; | ||
|
||
constructor(before?: string, after?: string, limit?: number) { | ||
this.after = after; | ||
this.before = before; | ||
this.limit = 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.
Why did we choose the definition? Could the interface be more lax? (not that easy)
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.
In Elasticsearch we have two ways:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after
"search_after": [1463538857, "654323"],
- Point In Time (
pit_id
)
"pit": {
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==",
"keep_alive": "1m"
},
We could certainly do something about it in the future if we want to take this option for other DS.
Code Climate has analyzed commit 6c6d635 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (98% is the threshold). This pull request will bring the total coverage in the repository to 99.0%. View more on Code Climate. |
Definition of Done
General
Security