Skip to content

Introspect Ecto Connection order field and direction from query #27

@seanabrahams

Description

@seanabrahams

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions