Apparently alot of ORM's do something like this:
query.filter(username == "bob")
to generate sql like
... WHERE username = 'bob'
Why override the == operator instead of something like:
query.filter(username.eq("bob"))
Apparently alot of ORM's do something like this:
query.filter(username == "bob")
to generate sql like
... WHERE username = 'bob'
Why override the == operator instead of something like:
query.filter(username.eq("bob"))
This is a subjective question, but in general I would say that the syntax for the former is more intuitive, and since many (if not most) ORM's do this it's generally expected (making it more intuitive).
The whole point of orm is brideing the "impedance mismatch" between object and relational world , So in theory you can be blissfully unaware of "=" in sql world and work with "==" of the object world.