I got compile error on the following for the type Boolean, but it works fine for other data types. Any ideas? Please advise. Thanks
inferred type arguments [Boolean] do not conform to method filter's type parameter bounds [T <: slick.lifted.Rep[_]]
[error] db.run(repo.filter(_.id == id).map(r => (r.id, r.name, r.isPublic)).update((id, name, isPublic)))
[error] type mismatch;
[error] found : proj.domain.mapping.RepositoryMapping => Boolean
[error] required: proj.domain.mapping.RepositoryMapping => T
[error] db.run(repo.filter(_.id == id).map(r => (r.id, r.name, r.isPublic)).update((id, name, isPublic)))
[error] ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
Here's the code:
def updateTest(id: Long, name: String, isPublic: Boolean): Unit = {
db.run(repo.filter(_.id == id).map(r => (r.id, r.name, r.isPublic)).update((id, name, isPublic)))
}
If you look at the QUERIES documentation you might find the following warning
Most operators mimic the plain Scala equivalents, but you have to use
===instead of==for comparing two values for equality and=!=instead of!=for inequality. This is necessary because these operators are already defined (with unsuitable types and semantics) on the base type Any, so they cannot be replaced by extension methods.
So change your code to use === as following:
def updateTest(id: Long, name: String, isPublic: Boolean): Unit = {
db.run(repo.filter(_.id === id).map(r => (r.id, r.name, r.isPublic)).update((id, name, isPublic)))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With