View source on GitHub |
An immutable class that represents a sequence of Orders.
Inherits From: Order
, expected_type
google.appengine.datastore.datastore_query.CompositeOrder(
orders
)
This class proactively flattens sub-orders that are of type CompositeOrder. For example: CompositeOrder([O1, CompositeOrder([02, 03]), O4]) is equivalent to: CompositeOrder([O1, 02, 03, O4])
Args | |
---|---|
orders
|
A list of Orders which are applied in order. |
Attributes | |
---|---|
orders
|
Methods
cmp
cmp(
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_pb2.EntityProto |
rhs
|
An entity_pb2.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. |
cmp_for_filter
cmp_for_filter(
filter_predicate
)
key
key(
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_pb2.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. |
key_for_filter
key_for_filter(
filter_predicate
)
reversed
reversed(
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. |
size
size()
Returns the number of sub-orders the instance contains.
__eq__
__eq__(
other
)
Return self==value.
__ne__
__ne__(
other
)
Return self!=value.