Imagine you're developing an API and have an endpoint that lists some entities
I'm currently doing more than just imagining 😀
I'm developing an API with that exact use case. My solution is more like number 2. The entities I use have a date so I use the date and a limit to paginate.
I would say that's an upgraded version of number 2, as you're using something that can be indexed in the database rather than a usually generated in query time index.
One question though, if you fetch by date then limit, how do you get the remainder entities for that date? Or is this not relevant in your case?
For now I'd say it's not relevant because it's actually not dates but datetimes (including seconds), so most entities should have a unique datetime, so remainders after applying the limit are quite unlikely to happen. This API is still in early stages of development and is not fully tested so I might have missed some issues though 😅
I'm currently doing more than just imagining 😀
I'm developing an API with that exact use case. My solution is more like number 2. The entities I use have a date so I use the date and a limit to paginate.
Nice!
I would say that's an upgraded version of number 2, as you're using something that can be indexed in the database rather than a usually generated in query time index.
One question though, if you fetch by date then limit, how do you get the remainder entities for that date? Or is this not relevant in your case?
For now I'd say it's not relevant because it's actually not dates but datetimes (including seconds), so most entities should have a unique datetime, so remainders after applying the limit are quite unlikely to happen. This API is still in early stages of development and is not fully tested so I might have missed some issues though 😅
Got it, so you could just use the datetime of the last one, and get the rest from there 👍
Exactly :)