This mixin grants sorting capabilities to a table statement instance via
composition.
Methods
-
orderBy( [sortExprStrList])
-
Establishes the order of one or more specific columns in the result set. This method does not cause the statement to be executed but changes the statement boundaries, which means that if it has been prepared before, it needs to be re-prepared.
Parameters:
Name Type Argument Description sortExprStrList
SortExprStrList <optional>
<repeatable>
One or more expressions establishing the order on which the given columns are sorted. Returns:
The Instance of the statement itself following a fluent API convention.- Type
- TableOrdering
Example
// arguments as columns (and direction) to sort const query = table.select('foo', 'bar').orderBy('foo asc', 'bar desc') // array of columns (and direction) to sort const query = table.select('foo', 'bar').orderBy(['foo asc', 'bar desc'])