Phoenix-Codeworx / phoenix-framework

A plugin-based graphql server framework built on Bun, Apollo, Mongo, and Express. Rising from the ashes of Reaction Commerce
MIT License
2 stars 0 forks source link

Add pagination via a common library #6

Open zenweasel opened 3 weeks ago

zenweasel commented 3 weeks ago

Right now we expect every resolver to solve the problem of how to performantly paginate through large data sets. This should be something provided by the framework similar to how RC did it. This package looks interesting. Could also borrow stuff from RC but would need to adapt it for Mongoose/TypeGoose

aldeed commented 2 weeks ago

From what I remember, the RC code could handle either cursor-based or page-based. It might be worth writing a new package that combines the one you link to with the RC approach. I could take a look at it since I wrote or reviewed most of the RC code.

zenweasel commented 2 weeks ago

@aldeed Yeah, I think that package also handles both cursor and page based. What features would be missing?

aldeed commented 1 week ago

Are you sure? The docs say

This module helps in implementing #2 - cursor based paging - by providing a method that make it easy to query within a Mongo collection.

zenweasel commented 1 week ago

@aldeed Yeah, you're right. I read that backwards thinking it did both offset and cursor but it only does cursor and I believe we would want both?

aldeed commented 1 week ago

I remember the general discussion with Reaction being that some frontend situations just don't work with cursor and others just don't work with offset, so we opted to support both. I believe there was a decision record about it. Obviously we don't have to, but if most of the hard coding work is done for it and can be adapted easily to mongoose, then it makes sense.

zenweasel commented 1 week ago

I think that makes sense. How do we want to structure this? All built into one package or with a few packages? I think I would tend to say just one package for simplicity sake

aldeed commented 1 week ago

Agree