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: add offset #326

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions postgrest/base_request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,17 @@
)
return self

def offset(self: _FilterT, size: int) -> _FilterT:
"""Set the starting row index returned by a query.
Args:
size: The number of the row to start at
"""
self.params = self.params.add(

Check warning on line 493 in postgrest/base_request_builder.py

View check run for this annotation

Codecov / codecov/patch

postgrest/base_request_builder.py#L493

Added line #L493 was not covered by tests
"offset",
size,
)
return self

Check warning on line 497 in postgrest/base_request_builder.py

View check run for this annotation

Codecov / codecov/patch

postgrest/base_request_builder.py#L497

Added line #L497 was not covered by tests

def range(self: Self, start: int, end: int) -> Self:
self.headers["Range-Unit"] = "items"
self.headers["Range"] = f"{start}-{end - 1}"
Expand Down
Loading