Skip to content

Commit

Permalink
feat: add offset (#326)
Browse files Browse the repository at this point in the history
Co-authored-by: joel@joellee.org <joel@joellee.org>
  • Loading branch information
J0 and joel@joellee.org committed Oct 22, 2023
1 parent 193c8df commit 7cd6751
Showing 1 changed file with 11 additions and 0 deletions.
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 @@ def limit(self: Self, size: int, *, foreign_table: Optional[str] = None) -> Self
)
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(
"offset",
size,
)
return self

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

0 comments on commit 7cd6751

Please sign in to comment.