[英]Scala, Play Framework Slick issue - could not find implicit value for parameter rconv
I'm following guidelines of Slick documentation and I don't understand what I'm doing wrong here: 我正在遵循Slick文档的指导原则,我不明白我在做错了什么:
package models
import scala.slick.session.Database
import Database.threadLocalSession
import scala.slick.jdbc.{GetResult, StaticQuery => Q}
import javax.sql.DataSource
import Q.interpolation
object Data {
case class User(user: String, password: String)
lazy val db = Database.forName("default")
def result: Option[User] = {
db.withSession {
sql"SELECT user, password FROM user WHERE user = 'user' AND password = 'pass'".as[User]
}
}
}
The line 这条线
sql"SELECT user, password FROM user WHERE user = 'user' AND password = 'pass'".as[User]
is giving me this: 给我这个:
Multiple markers at this line
- could not find implicit value for parameter rconv: scala.slick.jdbc.GetResult[models.Data.User]
- could not find implicit value for parameter rconv: scala.slick.jdbc.GetResult[models.Data.User]
What am I doing wrong here? 我在这做错了什么?
Play Framework 2.2.0, Scala 2.10.3, Slick 1.0.1 Play Framework 2.2.0,Scala 2.10.3,Slick 1.0.1
You need to provide the conversion function from result to user. 您需要提供从结果到用户的转换功能。 Copied and adapted straight from the slick home :
从光滑的家中直接复制和改编:
implicit val getUserResult = GetResult(r => User(r.<<, r.<<))
Or this section from the documentation you linked 或者您链接的文档中的此部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.