Need a sanity check on my idea for cursor pagination helper
I wanna create a helper to manage cursor-based pagination with Drizzle.
To create a cursor your select query needs to contain the columns on which your data is ordered - so you need to include those columns in select.
But my concern is that that may cause collisions
say
or
So I thought what if I would hash the keys provided with the cursor config - these have to be defined only once on app start-up so hashing perf cost is minimal.
and then what I will get is something like
And then I will also provide the helper which will remove these keys from returned array so that some junk doesn't go to the client
The only downside here is that sometimes columns may be returned twice:
but I'm not sure how bad this is
sooo... I just want a sanity check really. Does that sound like an okay-ish idea?
0 Replies