Interface DatastoreReader (2.19.2)

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
Name Description
query Query<T>
Returns
Type Description
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
Name Description
keys Key[]
Returns
Type Description
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
Name Description
key Key
Returns
Type Description
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
Name Description
keys Key[]
Returns
Type Description
Iterator<Entity>

runAggregation(AggregationQuery query)

public default AggregationResults runAggregation(AggregationQuery query)

Submits a AggregationQuery and returns AggregationResults.

Parameter
Name Description
query AggregationQuery
Returns
Type Description
AggregationResults

runAggregation(AggregationQuery query, ExplainOptions explainOptions)

public default AggregationResults runAggregation(AggregationQuery query, ExplainOptions explainOptions)

Submits a AggregationQuery with a specified com.google.cloud.datastore.models.ExplainOptions and returns AggregationResults.

Parameters
Name Description
query AggregationQuery
explainOptions ExplainOptions
Returns
Type Description
AggregationResults