View source on GitHub |
An immutable class that represents a relative position in a query.
Inherits From: expected_type
google.appengine.datastore.datastore_query.Cursor(
urlsafe=None, _cursor_bytes=None
)
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
advance(
offset, query, conn
)
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
@staticmethod
from_bytes( cursor )
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
@staticmethod
from_websafe_string( cursor )
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
reversed()
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
to_bytes()
Serialize cursor as a byte string.
to_websafe_string
to_websafe_string()
Serialize cursor as a websafe string.
Returns | |
---|---|
A base64-encoded serialized cursor. |
urlsafe
urlsafe()
Serialize cursor as a websafe string.
Returns | |
---|---|
A base64-encoded serialized cursor. |
__eq__
__eq__(
other
)
Return self==value.
__ne__
__ne__(
other
)
Return self!=value.