fluent-kit
fluent-kit copied to clipboard
Subqueries
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.