Gcloud::Datastore::Dataset::QueryResults

QueryResults is a special case Array with additional values. A QueryResults object is returned from Gcloud::Datastore::Dataset#run and contains the Entities from the query as well as the query's cursor and #more_results value.

entities = dataset.run query
entities.size #=> 3
entities.cursor #=> "c3VwZXJhd2Vzb21lIQ"

Please be cautious when treating the QueryResults as an Array. Many common Array methods will return a new Array instance.

entities = dataset.run query
entities.size #=> 3
entities.end_cursor #=> "c3VwZXJhd2Vzb21lIQ"
names = entities.map { |e| e.name }
names.size #=> 3
names.cursor #=> NoMethodError

Methods

Attributes

cursor [R]

end_cursor [R]

more_results [R]

The state of the query after the current batch.

Expected values are:

“MORE_RESULTS_AFTER_LIMIT”: “NOT_FINISHED”: “NO_MORE_RESULTS”:

Public Class Methods

new(arr = [], end_cursor = nil, more_results = nil)

Create a new QueryResults with an array of values.

Public Instance Methods

more_after_limit?()

Convenience method for determining id the #more_results value is “MORE_RESULTS_AFTER_LIMIT”

no_more?()

Convenience method for determining id the #more_results value is “NO_MORE_RESULTS”

not_finished?()

Convenience method for determining id the #more_results value is “NOT_FINISHED”