Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote
    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

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Shawn25
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tyt2y3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants