OuterfacesEctoApi.QueryEngine.QuerySort (Outerfaces Ecto API v0.2.8)

View Source

Summary

Functions

Sorts a query by an association’s field.

Sorts a query by a given field.

Functions

by_association_field(query, binding_index, field, direction)

Sorts a query by an association’s field.

Parameters:

  • query: The Ecto query.
  • binding_list: A list of binding atoms (e.g. [:organization, :department]).
    • or binding index
  • field: The field to sort on.
  • direction: The sort direction (:asc or :desc, default: :asc).

by_field(query, field, direction \\ :asc)

@spec by_field(
  query :: Ecto.Query.t(),
  sort_field :: atom(),
  sort_direction :: :asc | :desc
) :: Ecto.Query.t()

Sorts a query by a given field.

Parameters:

  • query: The Ecto query.
  • field: The field to sort on.
  • direction: The sort direction (:asc or :desc, default: :asc).