-
|
In 2.0.x, using Entity Loader seems like a good way. But why can I use .paginate() or .cursor_by() ? Only .one() and . all() ? |
Beta Was this translation helpful? Give feedback.
Answered by
tyt2y3
Nov 8, 2025
Replies: 2 comments 1 reply
-
|
good point, because it hasn't been added yet, but will be added soon |
Beta Was this translation helpful? Give feedback.
1 reply
-
let mut pager = staff::Entity::load()
.with(staff::Relation::ReportsTo)
.order_by_asc(staff::COLUMN.id)
.paginate(db, 2);
let staff = pager.fetch_and_next().await?.unwrap();
assert_eq!(staff[0].name, "Alan");
assert_eq!(staff[0].reports_to, None);
assert_eq!(staff[1].name, "Ben");
assert_eq!(staff[1].reports_to.as_ref().unwrap().name, "Alan");just pushed to master |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tyt2y3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just pushed to master