Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AND OR concept #16

Closed
aleksey-pchelnikov opened this issue Oct 9, 2015 · 6 comments
Closed

AND OR concept #16

aleksey-pchelnikov opened this issue Oct 9, 2015 · 6 comments
Labels

Comments

@aleksey-pchelnikov
Copy link
Collaborator

#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)

@v-ladynev
Copy link
Owner

I like the second variant at every item because there is not noise from dots and brackets there.

@samsonych
Copy link
Collaborator

I think usecase #1 (like Querydsl ) more logical. OR and AND clauses should be as methods.

@v-ladynev
Copy link
Owner

samsonych, development is not about a logic, but about a convenience.
#2 is convenient to read but it is hard to write cause of static imports.

@v-ladynev
Copy link
Owner

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.

@v-ladynev
Copy link
Owner

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 :)

@v-ladynev
Copy link
Owner

aleksey-pchelnikov, can you show how this "e1.and(e2).or(e3.and(e4))" will be in real code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants