File tree Expand file tree Collapse file tree
gcloud-java-datastore/src
main/java/com/google/gcloud/datastore
test/java/com/google/gcloud/datastore Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,9 +35,8 @@ public interface QueryResults<V> extends Iterator<V> {
3535 Class <?> resultClass ();
3636
3737 /**
38- * Returns the Cursor for the point after the value returned in the last {@link #next} call. Until
39- * v1beta3 is supported, this field should only be used if you have set a limit and the number of
40- * results is equal to that limit.
38+ * Returns the Cursor for the point after the value returned in the last {@link #next} call.
39+ * Currently, {@code cursorAfter} returns null in all cases but the last result.
4140 */
4241 Cursor cursorAfter ();
4342}
Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ public Class<?> resultClass() {
100100 @ Override
101101 public Cursor cursorAfter () {
102102 //return new Cursor(cursor); // only available in v1beta3
103- return new Cursor (queryResultBatchPb .getEndCursor ());
103+ if (!hasNext ()) {
104+ return new Cursor (queryResultBatchPb .getEndCursor ());
105+ }
106+ return null ;
104107 }
105108}
Original file line number Diff line number Diff line change @@ -478,7 +478,7 @@ public void testQueryPaginationWithLimit() throws DatastoreRpcException {
478478 }
479479 EasyMock .replay (rpcFactoryMock , rpcMock );
480480 Datastore mockDatastore =
481- this . options .toBuilder ()
481+ options .toBuilder ()
482482 .retryParams (RetryParams .defaultInstance ())
483483 .serviceRpcFactory (rpcFactoryMock )
484484 .build ()
You can’t perform that action at this time.
0 commit comments