View Source Resourceful.Collection.Sort (Resourceful v0.1.2)
Provides a common interface for sorting collections. See call/2
for use and
examples.
This module is intended to dispatch arguments to the appropriate Sort
module
for the underlying data source.
Link to this section Summary
Functions
Returns a data source that is sorted in accordance with sorters
.
Link to this section Types
@type t() :: {:asc | :desc, Resourceful.Collection.queryable()}
Link to this section Functions
Returns a data source that is sorted in accordance with sorters
.
If data_source
is not an actual list of resources (e.g. an Ecto Queryable)
underlying modules should not return a list of resources, but rather a sorted
version of data_source
.
args
Args
data_source
: SeeResourceful.Collection
module overview.sorters
: A list or comma separated string of sort parameters. Sort parameters should be the string name of a field preceded by, optionally, a+
for ascending order (the default) or a-
for descending order or. Examples ofsorters
:"name,-age"
["+name", "-age"]