Skip to content

fix: query params are immutable when using order #57

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

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
7 changes: 4 additions & 3 deletions postgrest_py/base_request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ def __init__(self, session: Union[AsyncClient, SyncClient]):
BaseFilterRequestBuilder.__init__(self, session)

def order(self, column: str, *, desc=False, nullsfirst=False):
self.session.params[
"order"
] = f"{column}{'.desc' if desc else ''}{'.nullsfirst' if nullsfirst else ''}"
self.session.params.add(
"order",
f"{column}{'.desc' if desc else ''}{'.nullsfirst' if nullsfirst else ''}",
)
return self

def limit(self, size: int, *, start=0):
Expand Down