fluent-kit icon indicating copy to clipboard operation
fluent-kit copied to clipboard

Subqueries

Open calebkleveter opened this issue 7 years ago • 0 comments

We should add support for sub-queries to the QueryBuilder. This feature already exists in the SQL repo, so changes for this should only be required in the Fluent and Fluent integration repos.

I'm thinking the best way to do this would be to pass in a QueryBuilder or SQLQuery conforming type into the filter methods and their operators:

let query = Pet.query(on: conn).filter(\.age > 7).decode(\.id)
User.query(on: conn).join(\User.id, to: \Pet.userID).filter(\Pet.id ~~ query).all()

Not the greatest example as the second query isn't needed, but it's the API design I am thinking of.

calebkleveter avatar Nov 06 '18 15:11 calebkleveter