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

Comments

Projects
None yet
2 participants
@heri16
Copy link
Contributor

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()
@ClickSimply

This comment has been minimized.

Copy link
Owner

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
You can’t perform that action at this time.