CursorTrait implementation for SelectTwo
Motivation
Cursor-based pagination is implemented for single tables, but we can't use it when querying with related table, even it's the same concept and most of the work done still apply.
Proposed Solutions
I don't know the best implementation but I guess Cursor struct should be edited to support two tables and the API should support some way of indicating which table columns on before and after belongs to.
Then CursorTrait can be implemented for SelectTwo and SelectTwoMany.
Hey @lasantosr, welcome! I think we could implement cursor pagination for SelectTwo. However, I don't think it's trivial to implement cursor pagination for SelectTwoMany. Because in SelectTwoMany, we query N parent rows and its M child rows in a single query then fold it into Vec<N, Vec<M>>. So, we cannot precisely paginate the result, for example a parent row with 101 child rows but the page size is just 100, we will leave one child behind.
You're right @billy1624, I missed that point, I think its enough for SelectTwo.
In the case of SelectTwoMany I guess we will have to paginate the main entity and then, if needed, paginate the related children.
Thanks!
Just an additional idea on Cursor: it's likely we can add a cursor method (in addition to cursor_by) which automatically uses the Entity's primary key as the cursor key. It won't work for SelectTwo though