case class Post(id: Option[Long], version:Int, title: String, content: String)
object Posts extends Table[Post]("posts") {
def id = column[Long]("id", O.PrimaryKey)
def version = column[Int]("version")
def title = column[String]("title")
def content = column[String]("content")
def * = id.? ~ version ~ title ~ content <>(Post, Post.unapply _)
}
val selectEntirePost:scala.slick.lifted.Query[Table[Post], Post] =
(for {post <- Posts if
post.id === 1L} yield (post))
selectEntirePost.update(new Post(Some(1), 1, "hello", "world")) //works
val selectSingleColumn:scala.slick.lifted.Query[Column[String], String] =
(for {post <- Posts if
post.id === 1L} yield ( post.content))
selectSingleColumn.update("big world") //works
val selectMultipleColumns:scala.slick.lifted.Query[(Column[Int], Column[String]), (Int, String)] =
(for {post <- Posts if
post.id === 1L} yield (post.version, post.content))
selectMultipleColumns.update(2, "cruel world") // value update is not a member of scala.slick.lifted.Query[(slick.driver.H2Driver.simple.Column[Int], slick.driver.H2Driver.simple.Column[String]),(Int, String)]