orderBy method
Orders the query results by a field.
Parameters:
field: The field to order by.descending: Whether to order descending (default: false).
Returns: A new Query with the ordering applied.
Example:
query = query.orderBy('age', descending: true);
Implementation
Query<T> orderBy(Object field, {bool descending = false}) {
if (field is FieldPath) {
field = field.getPath();
}
Query<T> newQuery = Query<T>(
helper: QueryHelper(),
oracledb: _oracledb,
path: path,
);
_helper.dupQuery(newQuery, this);
newQuery._explicitOrder.add({
"field": field,
"direction": descending ? "desc" : "asc",
});
return newQuery;
}