order method

void order(
  1. String orderString
)

Adds an order to this Query.

orderString has the form "-name" where 'name' is a fieldName of the model and the optional '-' says whether the order is descending or ascending.

Implementation

void order(String orderString) {
  // TODO: validate [orderString] (e.g. is name valid)
  if (orderString.startsWith('-')) {
    _orders.add(ds.Order(ds.OrderDirection.Descending,
        _convertToDatastoreName(orderString.substring(1))));
  } else {
    _orders.add(ds.Order(
        ds.OrderDirection.Ascending, _convertToDatastoreName(orderString)));
  }
}