Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting cursor with Objectify without iterating through items

I want to execute a query, get the results and then get the cursor to the next item if there is any. The only relevant post I found was: Objectify paging with Cursors

Is there a way of doing this without iterating through the items?

Query<User> query = ofy().load().type(User.class).limit(RecordLimit).filter("gameId", gameId);
//execute and get the results
List<User> users = query.list()
//get the cursor for the next user
like image 452
mbsheikh Avatar asked May 07 '26 19:05

mbsheikh


1 Answers

String cursor = query.iterator().getCursor().toWebSafeString();

Look at these unit tests to make things a bit more clear.

like image 195
varun Avatar answered May 10 '26 08:05

varun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!