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

api: add pagination support #261

Merged
merged 3 commits into from
Jan 13, 2023
Merged

Conversation

oleg-jukovec
Copy link
Collaborator

@oleg-jukovec oleg-jukovec commented Jan 11, 2023

A user could fetch a position of a last tuple using a new method of the SelectRequest type:

selectRequest = selectRequest.FetchPos(true)

The position will be stored in a new field of the Response type:

Response.Pos

A user could specify a tuple from which selection must continue or its position with a new method of the SelectRequest type:

selectRequest = selectRequest.After([]interface{}{23})

or

selectRequest = selectRequest.After(resp.Pos)

In action it looks like:

req := NewSelectRequest(space).Key(key).Limit(10).FetchPos(true)
for condition {
    resp, err := conn.Do(req).Get()
    // ...
    req = req.After(resp.Pos)
}
  1. Introduce pagination tarantool#7639
    I didn't forget about (remove if it is not applicable):

Related issues:

Closes #246

@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-246-pagination branch from 7c90bad to 4f34aaf Compare January 11, 2023 11:26
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

Thank you for your PR! Seems nice, I've found a couple of tricks that may be useful for me later. I have left a several minor comments.

.github/workflows/testing.yml Show resolved Hide resolved
.github/workflows/testing.yml Show resolved Hide resolved
request.go Show resolved Hide resolved
request.go Show resolved Hide resolved
request.go Outdated Show resolved Hide resolved
request.go Show resolved Hide resolved
response.go Outdated Show resolved Hide resolved
tarantool_test.go Outdated Show resolved Hide resolved
tarantool_test.go Outdated Show resolved Hide resolved
tarantool_test.go Outdated Show resolved Hide resolved
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-246-pagination branch from 4f34aaf to bb99816 Compare January 12, 2023 14:37
A user could fetch a position of a last tuple using a new method
of the SelectRequest type:

selectRequest = selectRequest.FetchPos(true)

The position will be stored in a new field of the Response type:

Response.Pos

A user could specify a tuple from which selection must continue or
its position with a new method of the SelectRequest type:

selectRequest = selectRequest.After([]interface{}{23})

or

selectRequest = selectRequest.After(resp.Pos)

In action it looks like:

req := NewSelectRequest(space).Key(key).Limit(10).FetchPos(true)
for condition {
    resp, err := conn.Do(req).Get()
    // ...
    req = req.After(resp.Pos)
}

1. tarantool/tarantool#7639

Part of #246
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-246-pagination branch from bb99816 to 930d5a0 Compare January 12, 2023 14:40
@oleg-jukovec oleg-jukovec merged commit c3215e1 into master Jan 13, 2023
@oleg-jukovec oleg-jukovec deleted the oleg-jukovec/gh-246-pagination branch January 13, 2023 08:59
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.

Add pagination support
3 participants