sqlboiler
sqlboiler copied to clipboard
Minor query builder improvements
This PR implements the following:
- Added
queries.BuildSubquery()which does the same thing asBuildQuery()except doesn't append a semicolon so query builder results can be embedded in other queries - Added `qm.WithSubquery() which allows generating a CTE using a query object built by sqlboiler
The WithSubquery() modifier is interesting imo because if there's interest, there are a number of query mods that could be added to work with subqueries to allow building pretty complex, type-checked queries without horrible code.
This is quite interesting and it makes complete sense. If everything checks out and it is completely backward compatible, it would make sense to merge now (or wait till v5 if not).
Just so you know, we are thinking of making the query builder more driver-specific, so that each driver could potentially support more specific things. This will likely happen in v5.
The base one will still exist for others to extend if they want so of course, this will still be useful.
This should be fully backwards compatible. If it's not, I'll make changes so that it is 👍
Just so you know, we are thinking of making the query builder more driver-specific, so that each driver could potentially support more specific things. This will likely happen in v5.
Interesting.. that makes sense. Looking forward to seeing what's coming!
I just noticed that this will not be backward compatible since the function signature of AppendWith changed.
In its current state, we will only be able to merge it into v5.
At some point over the next few days I'll see if I can come up with a change here to resolve this, will comment back either way
Come on merge it please!