Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

arnaud-moncel
Copy link
Member

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

import Page, { PlainPage } from '../page';
import Sort, { PlainSortClause } from '../sort';

export type PaginationType = 'page' | 'cursor';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤝

Comment on lines 3 to 13
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;
}
}
Copy link
Member

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)

Copy link
Member

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:

"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.

Copy link

codeclimate bot commented Nov 20, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants