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

Introspect Ecto Connection order field and direction from query #27

Open
seanabrahams opened this issue Jul 19, 2016 · 0 comments
Open

Comments

@seanabrahams
Copy link
Member

seanabrahams commented Jul 19, 2016

We recently updated the API for Ecto Connections to accept arguments for sorting the connection by adding ordered_by and ordered_by_direction arguments. This works if you want to sort by the Connection's underlying table, but not if you want to sort by a joined table.

Thinking on this it became clear that we can simply look to see if the passed in Ecto query has an order_by clause from which we can then derive the sort field and direction. We don't need separate ordered_by and ordered_by_direction arguments. Just introspect the query.

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

No branches or pull requests

1 participant