Comments (2)
Thank you for your feature request.
Well, the short answer is no. I used relay-styled pagination around 4 years ago for this website, but switched to limit-offset style a while later for simplicity. I have no plan to switch back to relay in the near future.
If I remember correct, I added this line to roadmap because I thought it was possible to implement relay-style pagination to diesel with some minor modifications, as I managed to solved dynamic query (passed from async-graphql
) in this project, which is quite a complex problem.
As you said there are little resources to follow, I can give you some ideas about how to implement it.
Rust is a low level language and implementing relay specifications is up to yourself. One approach is to translate first
and last
to select ... limit {first} order by {order_field} {asc/desc}
in sql, and before
and after
to something like ... where {order_field} > {after} order by {order_field} {asc/desc}
. If you follow my code, you can change the query parameters in src/gql_schema/*.rs
to achieve that, but any backend/ORM that support dynamic query can do the trick. before
and after
can be encoded as {query_name}:{order_field_value}
or whatever unique token you like.
Another approach is to use built-in cursor in postgresql, but I am not familiar with that and cannot give you advice about it.
Going to close this issue.
from cindy-next-rust.
I have implemented the feature here async-graphql/async-graphql#563 (comment), Thanks a lot for the input, Would you like to add any suggestions for improvement?
from cindy-next-rust.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cindy-next-rust.