简体   繁体   English

Slick 3.0.3错误:找不到参数rconv的隐式值

[英]Slick 3.0.3 error: could not find implicit value for parameter rconv

I have the model as Tables.scala generated with Slick 3.0.3 that includes the GetResult implicit conversion from a result set for all my model classes eg 我有一个由Slick 3.0.3生成的Tables.scala模型,其中包括来自我所有模型类的结果集的GetResult隐式转换

implicit def GetResultInstrumentRow(implicit e0: GR[Int], e1: GR[String], e2: GR[Option[String]], e3: GR[Char], e4: GR[Option[Int]]): GR[InstrumentRow] = GR{
  prs => import prs._
  InstrumentRow.tupled((<<[Int], <<[String], <<?[String], <<[Char], <<?[Int], <<?[Int], <<[Int]))
}

but still the following code produces error could not find implicit value for parameter rconv: slick.jdbc.GetResult[models.Tables.InstrumentRow] : 但是以下代码仍然产生错误could not find implicit value for parameter rconv: slick.jdbc.GetResult[models.Tables.InstrumentRow]

import play.api.db.DB
import slick.driver.PostgresDriver.backend.Database._
import slick.jdbc.{StaticQuery => Q}
import play.api.Play.current

import models.Tables._

class InstrumentDao {
  /**
   * Returns all available instruments.
   *
   * @return all available instruments.
   */
  def findInstruments() : List[InstrumentRow] = DB.withConnection() { implicit conn =>
    Q.queryNA[InstrumentRow](s"""select * from "${Instrument.baseTableRow.tableName}"""").list
  }   
}

Oh found the problem, it wasn't related to the code on the OP, that code is correct and works as it should. 哦,发现了问题,它与OP上的代码无关,该代码正确无误,并且可以正常工作。 The issue was on the code generator/and the implicit implementation namely it didn't like an attribute of type Char ie on the Postgres database CHAR(1) : 问题出在代码生成器/和隐式实现上,即它不喜欢Char类型的属性,即在Postgres数据库CHAR(1)

Changing from CHAR(1) to VARCHAR(3) and re running the code generator solved the issue from: CHAR(1)更改为VARCHAR(3)并重新运行代码生成器解决了以下问题:

 case class InstrumentRow(id: Int, `type`: Char)
 implicit def GetResultInstrumentRow(implicit e0: GR[Int], e1: GR[Char]): GR[InstrumentRow] = GR{
     prs => import prs._
     InstrumentRow.tupled((<<[Int], <<[Char]))
 }

to

 case class InstrumentRow(id: Int, `type`: String)
 implicit def GetResultInstrumentRow(implicit e0: GR[Int], e1: GR[String]): GR[InstrumentRow] = GR{
     prs => import prs._
     InstrumentRow.tupled((<<[Int], <<[String]))
 }

It seems like a bug in the implicit conversion and/or the generator. 似乎是隐式转换和/或生成器中的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Scala,Play Framework Slick问题 - 无法找到参数rconv的隐含值 - Scala, Play Framework Slick issue - could not find implicit value for parameter rconv 编译表定义时出现光滑错误:无法找到参数tm的隐含值 - Slick error while compiling table definitions: could not find implicit value for parameter tm 错误:找不到参数p的隐式值:scala.slick.jdbc.SetParameter [java.util.UUID] - Error:could not find implicit value for parameter p: scala.slick.jdbc.SetParameter[java.util.UUID] Scala错误无法找到参数的隐式值 - Scala error Could not find implicit value for parameter Slick:找不到参数 e 的隐式值:slick.jdbc.SetParameter[Option[java.util.UUID]] - Slick: could not find implicit value for parameter e: slick.jdbc.SetParameter[Option[java.util.UUID]] 这作为隐式参数-找不到参数的隐式值 - this as implicit parameter - could not find implicit value for parameter 未指定的值参数rconv - Unspecified value parameter rconv 无法找到参数的隐含值 - Could not find implicit value for parameter 找不到参数tt的隐式值:slick.ast.TypedType [List [List [Int]]] - Could not find implicit value for parameter tt: slick.ast.TypedType[List[List[Int]]] Scala 微风错误:找不到参数的隐式值 - Scala breeze error: could not find implicit value for parameter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM