Using the class com.google.cloud.datastore.DatastoreReader.java(v1.3.1) to query Google Cloud Storage, how do I know when there are no more results? I noticed that I continue to return the cursor, even if it seems that there are no results.
Am I guaranteed to get an iterator with values back if there are values left as a result of my query?
Am I guaranteed to get the number of elements set with a limit in the query if there are enough elements in the query result set?
QueryResults<Entity> queryResults = null;
do {
final EntityQuery query = newEntityQueryBuilder()
.setKind(ENTITY_KIND)
.setLimit(50)
.setStartCursor((null!=queryResults)?queryResults.getCursorAfter():Cursor.copyFrom(new byte[0]))
.build();
queryResults = datastore.run(query);
queryResults.forEachRemaining(entity -> {
});
} while ( ??? );
source
share