Torch.Helpers.sort
You're seeing just the function
sort
, go back to Torch.Helpers module for more information.
Specs
Determines how the query for an index action should be sorted.
Relies on the "sort_field"
and "sort_direction"
parameters to be passed.
By default, it sorts by :id
in ascending order.
Examples
iex> sort(%{"sort_field" => "name", "sort_direction" => "desc"})
{:desc, :name}
iex> sort(%{})
{:asc, :id}
In a query pipeline, use in conjunction with Ecto.Query.order_by/3
:
order_by(query, ^sort(params))