News for hackers. Stuff that matters.
Re:Paginating Requests in APIs (2020) by andrewmackrodt on Saturday May 28, 2022 @03:09PM (#31542849)
I haven't had a need to implement this but something like the following should work to provide the same* records regardless of insertion/deletion.

* data of the record may have been updated, but if there are 1,000 records total, paginating in either direction will always return those same 1,000 records regardless of insertion/deletion.

- Filter by created_at <= time the endpoint first returned a result.

- Utilize soft deletes, where deleted_at IS NULL OR deleted_at < time the endpoint first returned a result.

Any keys allowed to be used in the ORDER BY query should also be immutable.

There are no comments on this comment yet.