SollmoStudio / beyond

Beyond: The Scalable Game Server Framework
http://www.beyondframework.com
Apache License 2.0
25 stars 9 forks source link

Add orderBy method to DB API. #134

Closed sgkim126 closed 10 years ago

sgkim126 commented 10 years ago

This patch orderBy method to Collection. This method return new collection that returns the sorted result.

For example, `collection.orderBy('fieldName', db.ASC)' will be new collection that returns the result with sorted by fieldName in ascending order.

If you want the result sorted by field1' in ascending andfield2' in descending, you have to call orderBy twice like `collection.orderBy('field2', db.DESC).orderBy('field1', db.ASC)'.

If you call orderBy tiwce with the same field, the last one will be applied. In other words, `collection.orderBy('fieldName', db.DESC).orderBy('fieldName', db.ASC)' will retrun the result in ascending.

kseo commented 10 years ago

Landed manually.