I'm using phantom dsl library to perform scylladb operations. Now I was trying to combine 'where' clause with 'or' clause but its not working.
db.object
.select
.where(_.businessEmail eqs "[email protected]")
.or(_.homeEmail eqs "[email protected]")
.or(_.additionalEmail eqs "[email protected]")
.fetch()
Error:
value or is not a member of com.outworkers.phantom.builder.query.SelectQuery[com.outworkers.phantom.builder.Unlimited,com.outworkers.phantom.builder.Unordered,com.outworkers.phantom.builder.Unspecified,com.outworkers.phantom.builder.Chainned,shapeless.HNil]
possible cause: maybe a semicolon is missing before `value or`?
.or(_.homeEmail eqs "[email protected]")
How can I use 'or' clause?
The where method from SelectQuery returns again a
SelectQuery, which allows you to invoke and method that will be translated as anANDoperator in theWHEREclause. If you look at the methods ofSelectQuery, you will not find any of them that lets use theORoperator in theWHEREclause because OR operator is supported in ScyllaDB.In the official docs of ScyllaDB, you will also see that a select statement doesn't have an
ORoperator and the same happens for a select statement in CQL.There is an open issue in the repo of ScyllaDB to Add basic support for the logical OR operator in CQL. Not sure if that will be added to phantom knowing that the last commit was on Aug 16, 2021.