mickhansen / graphql-sequelize

GraphQL & Relay for MySQL & Postgres via Sequelize
MIT License
1.9k stars 172 forks source link

Feature request: explicit offset argument support in sequelize connection #612

Closed jedwards1211 closed 6 years ago

jedwards1211 commented 6 years ago

I generally want to use connections for lists of things in my GraphQL so that they'll support relay-style paging if necessary. However the business requirement for some of my views is to have Page 1 2 3 etc. buttons, which AFAIK can only be implemented with a manual offset. So in my own code I've been using a connection implementation that supports an offset argument in addition to the normal spec.

@mickhansen @janmeier would you guys be open to a PR to add an offset argument to sequelizeConnection after my other PR has been merged?

mickhansen commented 6 years ago

sequelizeConnection implements the relay connection spec, that's the intent, i don't think it would be prudent to change on that.

but you can obviously easily inject your own arguments into the connection and add logic in a before() hook

jedwards1211 commented 6 years ago

yeah I guess I could add in the offset option in my own before hook. I wasn't suggesting deviating from the relay connection spec, only adding this additional capability. But doing it in my own hook is not too difficult