Interface DatastoreReader (2.18.5)

public interface DatastoreReader

An interface to represent Google Cloud Datastore read operations.

Methods

<T>run(Query<T> query)

public abstract QueryResults<T> <T>run(Query<T> query)

Submits a Query and returns its result.

Parameter
NameDescription
queryQuery<T>
Returns
TypeDescription
QueryResults<T>

fetch(Key[] keys)

public abstract List<Entity> fetch(Key[] keys)

Returns a list with a value for each given key (ordered by input). null values are returned for nonexistent keys. When possible prefer using #get(Key...) to avoid eagerly loading the results.

Parameter
NameDescription
keysKey[]
Returns
TypeDescription
List<Entity>

get(Key key)

public abstract Entity get(Key key)

Returns an Entity for the given Key or null if it doesn't exist.

Parameter
NameDescription
keyKey
Returns
TypeDescription
Entity

get(Key[] keys)

public abstract Iterator<Entity> get(Key[] keys)

Returns an Entity for each given Key that exists in the Datastore. The order of the result is unspecified. Results are loaded lazily, so it is possible to get a DatastoreException from the returned Iterator's hasNext or next methods. See Also: #get(Key)

Parameter
NameDescription
keysKey[]
Returns
TypeDescription
Iterator<Entity>

runAggregation(AggregationQuery query)

public default AggregationResults runAggregation(AggregationQuery query)

Submits a AggregationQuery and returns AggregationResults.

Parameter
NameDescription
queryAggregationQuery
Returns
TypeDescription
AggregationResults