One thing that I didn’t mention was that these methods can be chained in any order. This is one of the benefits of using a query builder versus just concatenating the parts of the actual query string. And this was also the reason for turning to fluent interfaces: so I wouldn’t have to manage a large number of combinations between different types (in my case, every method returns an instance of QueryPart
).
@v-i-s-h in this regard I believe that +
better reflects the commutative nature of the operation and the fact that the types are the same (one does not lead to the next).
@pdeffebach my issue has to do with scoping all the “dot” operations to an object – I can’t see a similar syntax with Lazy
, can you give me an example, please?
@Raf That’s interesting - if it’s not possible to have an expression that starts with a .
I could potentially “bootstrap” the expression. It can’t be select(...)
as the methods can be chained in any order and they’re not required (select(...)
can be absent, meaning SELECT *
). But something like:
@with QueryBuilder.from(...).order(...).limit(...)
could be a good starting point.
Thanks