나는 Slick documentation example for autoincrementing fields을 따르고 있으며 mapped projection을 만드는 데 문제가 있습니다 ... 글쎄, 하나의 열만 있습니다.Slick에서 한 개의 열만 스칼라로 투영합니다.
case class UserRole(id: Option[Int], role: String)
object UserRoles extends Table[UserRole]("userRole") {
def id = column[Int]("ID", O.PrimaryKey, O.AutoInc)
def role = column[String]("ROLE")
// ...
def * = id.? ~ role <> (UserRole, UserRole.unapply _)
// NEXT LINE ERRORS OUT
def forInsert = role <> ({t => UserRole(None, t._1)}, {(r: UserRole) => Some((r.role))}) returning id
}
는 오류가
가 나 또한 그렇게처럼 내 스키마를 설계하는 것이 더 효율적이 될 거라고 생각했다 "값 <>이 scala.slick.lifted.Column [문자열]의 멤버가 아닙니다"입니다 :case class UserRole(role: String)
object UserRoles extends Table[UserRole]("userRole") {
def role = column[Int]("ROLE", O.PrimaryKey)
// ...
def * = role <> (UserRole, UserRole.unapply _)
}
하지만 위와 같은 오류가 발생하기 시작합니다. "<>은 scala.slick.lifted.Column의 멤버가 아닙니다. [0127] 단 하나의 열만 있기 때문에 더 이상 projection이 없습니까? 그렇다면 무엇을 해야합니까 내가하고 있을까요?