We\'d like to run a patch/partial UPDATE
with Slick (3.0.0) so that we only modify some of the fields in a record. Exactly which fields will be updated exactly will
Why not do the pattern matching before constructing the update query?
def patchPerson(name: Option[String], age: Option[Int]) = {
val query = people.filter(_.name === "M Odersky")
(name, age) match {
case (Some(name), Some(age)) =>
query.map(p => (p.name, p.age)).update(name, age)
case (Some(name), None) =>
query.map(p => p.name).update(name)
case (None, Some(age)) =>
query.map(p => p.age).update(age)
}
}