App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | List of all members
google.appengine.datastore.datastore_query.Order Class Reference
Inheritance diagram for google.appengine.datastore.datastore_query.Order:
google.appengine.datastore.datastore_query._PropertyComponent google.appengine.datastore.datastore_query._BaseComponent google.appengine.datastore.datastore_query.CompositeOrder google.appengine.datastore.datastore_query.PropertyOrder

Public Member Functions

def reversed
 
def key_for_filter
 
def cmp_for_filter
 
def key
 
def cmp
 
- Public Member Functions inherited from google.appengine.datastore.datastore_query._BaseComponent
def __eq__
 
def __ne__
 

Detailed Description

A base class that represents a sort order on a query.

All sub-classes must be immutable as these are often stored without creating a
defensive copying.

This class can be used as either the cmp or key arg in sorted() or
list.sort(). To provide a stable ordering a trailing key ascending order is
always used.

Member Function Documentation

def google.appengine.datastore.datastore_query.Order.cmp (   self,
  lhs,
  rhs,
  filter_predicate = None 
)
Compares the given values taking into account any filters.

This function can be used as the cmp argument for list.sort() and sorted().

This function is slightly more efficient that Order.key when comparing two
entities, however it is much less efficient when sorting a list of entities.

Args:
  lhs: An entity_pb.EntityProto
  rhs: An entity_pb.EntityProto
  filter_predicate: A FilterPredicate used to prune values before comparing
entities or None.

Returns:
  An integer <, = or > 0 representing the operator that goes in between lhs
  and rhs that to create a true statement.
def google.appengine.datastore.datastore_query.Order.key (   self,
  entity,
  filter_predicate = None 
)
Constructs a "key" value for the given entity based on the current order.

This function can be used as the key argument for list.sort() and sorted().

Args:
  entity: The entity_pb.EntityProto to convert
  filter_predicate: A FilterPredicate used to prune values before comparing
entities or None.

Returns:
  A key value that identifies the position of the entity when sorted by
  the current order.
def google.appengine.datastore.datastore_query.Order.reversed (   self,
  group_by = None 
)
Constructs an order representing the reverse of the current order.

This function takes into account the effects of orders on properties not in
the group_by clause of a query. For example, consider:
  SELECT A, First(B) ... GROUP BY A ORDER BY A, B
Changing the order of B would effect which value is listed in the 'First(B)'
column which would actually change the results instead of just reversing
them.

Args:
  group_by: If specified, only orders on properties in group_by will be
reversed.

Returns:
  A new order representing the reverse direction.

The documentation for this class was generated from the following file: