I have a case class Employee
case class Employee(id: Int,
name: String,
age: Int, is_permanent: Boolean,
company_name: String)
I am filtering on this Employee case class using Quill SQL like this:
quote {
query[Employee]
.filter(e => e.age > 100)
.filter(e => liftQuery(List("Robin, Peter")).contains(e.name))
}
It compiles fine.
Now I want to put the second filter
into a function and reuse it.
Like
val employeeQueryFunc: (Employee => Boolean) = e => {
liftQuery(List("Robin, Peter")).contains(e.name)
}
and then apply this function at multiple locations wherever I need. If I put this to the employee query like this
quote {
query[Employee]
.filter(e => e.age > 100)
.filter(employeeQueryFunc)
}
It does not compile. I get the error
this.Employee]).filter(((e: FindAllIssuesRepoQuery.this.Employee) => e.age.> .
(100))).filter(employeeQueryFunc)' can't be parsed to 'Ast'
Ideally it should have compiled as the filter block also contains a function that returns a boolean and employeeQueryFunc
also returns a boolean. Does anyone know how it can be reused as a function ??