The way you would implement this probably depends on the database you’re using. For example, Cassandra natively supports a serializable paging state that you could use in the page token.
Hi Tim,
First of all sorry for the late response ;)
Unfortunately i’m using google cloud spanner whitch who does not support pagging state, so i changed the design of API, by binding page and size parameters to LIMIT & OFFSET sql query params.
That works. Another thing you could do would be to encode the page & size into a custom token format (it could even just be a string in a format like page=1&size=10) that you then unpack again in the call implementation, which would decouple the client from the internal implementation. The benefit of that would be that if you ever change to another database in the future that doesn’t support limit and offset queries, you wouldn’t have to change the client API, which just treats the next page token as some opaque string.