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

Reversed order of arguments in the reverse order of Ecto #156

Open
tadiou opened this issue Feb 22, 2022 · 2 comments
Open

Reversed order of arguments in the reverse order of Ecto #156

tadiou opened this issue Feb 22, 2022 · 2 comments
Labels

Comments

@tadiou
Copy link

tadiou commented Feb 22, 2022

the keyword args of desc: :id vs id: :desc. the former being ecto, the latter being paginator.

Is there a reason why they're incongruent, and if not, would y'all accept a PR to switch that to be congruent to what Ecto is currently doing?

@sgerrand
Copy link
Contributor

sgerrand commented Mar 9, 2022

Hello and thanks for your question. For the my benefit and that of other future readers, would you please expand on what you have referred to in your question, ideally with a working example?

@glennr
Copy link

glennr commented Sep 25, 2023

In Ecto:

Ecto.Query.order_by(query, [desc: :inserted_at, desc: :id])

With paginator, the cursor arguments have these reversed:

  paginate(query, cursor_fields: [inserted_at: :desc, id: :desc])

Given query sorting and cursor generation are so closely related, it'd be nice to be able to use the same arguments, based on how Ecto does it i.e. [desc: :inserted_at, desc: :id]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants