orderBy method

void orderBy(
  1. List<OrderClauseGenerator<T>> clauses
)

Orders the result by the given clauses. The clauses coming first in the list have a higher priority, the later clauses are only considered if the first clause considers two rows to be equal.

Example that first displays the users who are awesome and sorts users by their id as a secondary criterion:

(db.select(db.users)
   ..orderBy([
     (u) =>
       OrderingTerm(expression: u.isAwesome, mode: OrderingMode.desc),
     (u) => OrderingTerm(expression: u.id)
   ]))
 .get()

Implementation

void orderBy(List<OrderClauseGenerator<T>> clauses) {
  orderByExpr = OrderBy(clauses.map((t) => t(table.asDslTable)).toList());
}