cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@maniatis.org>
Subject Re: new fluent API
Date Wed, 15 Apr 2015 08:48:33 GMT
On 15/04/2015 6:35pm, Andrus Adamchik wrote:
> 
>> On Apr 15, 2015, at 11:06 AM, Aristedes Maniatis <ari@maniatis.org> wrote:
>>
>> This can be useful when you pass queries around between functions or inside conditions
and loops. In my opinion, "where" should be an alias of "and".
> 
> So right now it is the opposite - "and" and "or" are both aliases to "where" when there's
no qualifier. 

Yes. Most operations replace the existing query properties (where, orderBy, prefetch, cacheGroups,
etc) where others append to them (and, or).

Personally, from my limited use of them in a real application, the appending mode seems far
more useful. I can't think of an occasion I'd ever want the replace option. It makes some
code harder to write since you need to know whether you already have a where, ordering or
prefetch already added.

Another approach might be to have the ability to clear existing properties, with one of these
syntaxes:

query.prefetchClear()
query.prefetch()

I still can't think of the sort of application that would require this.


I probably should have raised these use-cases before our last milestone but it really was
putting it into a live application that made me think about this more in this way.

Ari



-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Mime
View raw message