Closed aleksey-pchelnikov closed 8 years ago
I like the second variant at every item because there is not noise from dots and brackets there.
I think usecase #1 (like Querydsl ) more logical. OR and AND clauses should be as methods.
samsonych, development is not about a logic, but about a convenience.
Ok, I think we can divide a problem on some parts. For an example we can use "and(e1, e2, e3, e4)" in #4 and "or(e1, e2, e3, e4)" in #5 any way.
In #1 and #2 in the first variant left and right part is the same e1.and(e2).or(e3.and(e4))
but on the left we use "e1.and(e2).or" and "or(e3.and(e4))" on the right :)
aleksey-pchelnikov, can you show how this "e1.and(e2).or(e3.and(e4))" will be in real code?
1
WHERE (E1 AND E2) OR (E3 AND E4)
//it's like Querydsl e1.and(e2).or(e3.and(e4))
or(and(e1, e2), and(e3, e4))
2
WHERE (E1 OR E2) AND (E3 OR E4)
e1.or(e2).and(e3.or(e4))
and( or(e1, e2), or(e3, e4) )
3
WHERE (E1 OR E2) AND E3
e1.or(e2).and(e3))
and( or(e1, e2), e3 )
4
WHERE E1 AND E2 AND E3 AND E4
e1.and(e2).and(e3).and(e4)
and(e1, e2, e3, e4)
5
WHERE E1 OR E2 OR E3 OR E4
e1.or(e2).or(e3).or(e4)
or(e1, e2, e3, e4)