我正在研究play-slick3演示,我看到了这个表的定义
private class ProjectsTable(tag: Tag) extends Table[Project](tag, "PROJECT") {
def id = column[Long]("ID", O.AutoInc, O.PrimaryKey)
def name = column[String]("NAME")
def * = (id, name) <> (Project.tupled, Project.unapply)
def ? = (id.?, name.?).shaped.<>({ r => import r._; _1.map(_ => Project.tupled((_1.get, _2.get))) }, (_: Any) => throw new Exception("Inserting into ? projection not supported."))
}
最后一行是什么意思?我在文档或API
中找不到任何相关内容答案 0 :(得分:0)
根据http://www.developmentalmadness.com/2016/02/23/scala-connecting-to-postgres-via-slick-3/
的评论将整行映射到选项。对外连接很有用。