I am using the Nodejs Cassandra driver and I want to get the previous and next page. So far, the documentation shows retrieving the next page, which saves pageState from the previous page and passes it as a parameter. Unfortunately, there is no information on how to go to the previous page.
As I see, there are two options:
Save each pageState and page as a key-value pair and use pageState for the page you want to go to.
Save the data in an array and use the array to go to the previous page. (I do not think this is a good solution, since I will have to store large chunks of data in memory.)
Both methods do not seem to be an elegant solution for me, but if I have to choose, I will use the first.
Is there a way to do this out of the box using the Nodejs Cassandra driver ?
Another thing is that in the documentation manual swapping is used when calling eachRow function. If I understand correctly, it gives you every row as soon as it is red from the database. The problem is that this is implemented in my API, and I am returning data for the current page in the HTTP response. Therefore, in order to do this, I will need to push each row to a custom array, and then return the array when the data for the current page is retrieved. Is there a way to use execute with manual paging since the above seems redundant?
thanks
EDIT:
This is my data model:
CREATE TABLE store_customer_report ( store_id uuid, segment_id uuid, report_time timestamp, sharder int, customer_email text, count int static, first_name text, last_name text, PRIMARY KEY ((store_id, segment_id, report_time, sharder), customer_email) ) WITH CLUSTERING ORDER BY (customer_email ASC)
I show the data in the grid so that the user can navigate through it. When I write this, I thought about how to do this without requiring the previous functions, but nonetheless, I think this is a valid case and it will be great if there is an elegant solution.