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

Pagination by cursor #63

Closed
heri16 opened this issue Jul 6, 2018 · 1 comment
Closed

Pagination by cursor #63

heri16 opened this issue Jul 6, 2018 · 1 comment

Comments

@heri16
Copy link
Contributor

@heri16 heri16 commented Jul 6, 2018

How can we do pagination by cursor?
Cursor is a uuid: the primary key of the last object returned in the previous page.

nSQL().select('table').offset('uuid').limit(10).exec()
@only-cliches
Copy link
Owner

@only-cliches only-cliches commented Jul 20, 2018

Just set this up on version 1.7.1, should be live on NPM in the next few hours.

Usage:

nSQL().select("table").getCursor(20 /* page size*/).then((getNextPage) => {
    getNextPage().then((rows) => {
        console.log(rows) // first 20 rows
    });
});

Let me know if this works for you!

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

Successfully merging a pull request may close this issue.

None yet
2 participants