google.appengine.datastore.datastore_query.Cursor

An immutable class that represents a relative position in a query.

Inherits From: expected_type

The position denoted by a Cursor is relative to a result in a query even if the result has been removed from the given query. Usually to position immediately after the last result returned by a batch.

A cursor should only be used on a query with an identical signature to the one that produced it or on a query with its sort order reversed.

Methods

advance

View source

Advances a Cursor by the given offset.

Args
offset The amount to advance the current query.
query A Query identical to the one this cursor was created from.
conn The datastore_rpc.Connection to use.

Returns
A new cursor that is advanced by offset using the given query.

from_bytes

View source

Gets a Cursor given its byte string serialized form.

The serialized form of a cursor may change in a non-backwards compatible way. In this case cursors must be regenerated from a new Query request.

Args
cursor A serialized cursor as returned by .to_bytes.

Returns
A Cursor.

Raises
datastore_errors.BadValueError if the cursor argument does not represent a serialized cursor.

from_websafe_string

View source

Gets a Cursor given its websafe serialized form.

The serialized form of a cursor may change in a non-backwards compatible way. In this case cursors must be regenerated from a new Query request.

Args
cursor A serialized cursor as returned by .to_websafe_string.

Returns
A Cursor.

Raises
datastore_errors.BadValueError if the cursor argument is not a string type of does not represent a serialized cursor.

reversed

View source

DEPRECATED. It is no longer necessary to call reversed() on cursors.

A cursor returned by a query may also be used in a query whose sort order has been reversed. This method returns a copy of the original cursor.

to_bytes

View source

Serialize cursor as a byte string.

to_websafe_string

View source

Serialize cursor as a websafe string.

Returns
A base64-encoded serialized cursor.

urlsafe

View source

Serialize cursor as a websafe string.

Returns
A base64-encoded serialized cursor.

__eq__

View source

Return self==value.

__ne__

View source

Return self!=value.