Skip to content

Support for join/alsoDecode #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Cellane opened this issue Jul 30, 2018 · 4 comments
Open

Support for join/alsoDecode #12

Cellane opened this issue Jul 30, 2018 · 4 comments
Milestone

Comments

@Cellane
Copy link
Contributor

Cellane commented Jul 30, 2018

Motivation Behind Feature

At this moment, unless I’m mistaken, Pagination needs to operate on a QueryBuilder that produces Future<[Model]>. That makes it unable to paginate results that also fetch data from a different table, by using the Fluent’s join(_:to:)/alsoDecode(_:) methods, as these change the eventual output of QueryBuilder to Future<[(ModelA, ModelB)]>.

Feature Description

It would be awesome if we could paginate even these slightly more complicated queries. I get a feeling that the eventual implementation would have to also rely on an implementation of #11 that would allow us to specify how should the end result be joined for a valid JSON representation.

Alternatives or Workarounds

None considered or thought of.

@anthonycastelli
Copy link
Member

I've not given this much thought as it's not crossed my mind, however, I do see how this would be a need for some people. I'll look into implementing something like this, but if you do have any ideas, feel free to submit PR

@damirstuhec
Copy link

I think this would be a very welcoming addition. Personally, I have an example of a /feed route that should return a heterogeneous array of feed items with different types.

If we had support for something like @Cellane proposes, then we don't have to do a weird dance of type erasure in order to support decoding/encoding of that heterogeneous array and instead rely on the multi-type pagination to return a result including a separate array for every type.

@anthonycastelli
Copy link
Member

Just wanted to circle back to these issues and say I haven't forgotten about them. Just been swamped lately so haven't had a chance to work on anything regarding these packages. 🙂

@gperdomor
Copy link
Member

Any progress here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants