How do you update multiple columns using Slick Lifted Embedding?

expert picture expert · May 26, 2013 · Viewed 13.7k times · Source

How do you update multiple columns using Slick Lifted Embedding ? This document doesn't say much.

I expected it to be something like this

Query(AbilitiesTable).filter((ab: AbilitiesTable.type) => ab.id === ability_id).map((ab: AbilitiesTable.type) => (ab.verb, ab.subject)).update("edit", "doc")

Answer

expert picture expert · May 26, 2013

I figured it out. It should be like this

val map = Query(AbilitiesTable)
  .filter(_.id === ability_id)
  .map(ab => ab.verb ~ ab.context)

map.update(("", ""))

Typesafe, why your documentation is so bad ? I have to Google pretty much every silly thing or dig through unit-tests for hours. Please improve it. Thanks.