简体   繁体   English

找不到参数tt的隐式值:slick.ast.TypedType [List [List [Int]]]

[英]Could not find implicit value for parameter tt: slick.ast.TypedType[List[List[Int]]]

In postgres I am trying to map column of type integer[][] using slick 3.2 在postgres中,我尝试使用slick 3.2映射类型integer [] []的列

When trying to define below 尝试在下面定义时

def bbox = column[List[List[Int]]]("bbox")

I get the following error 我收到以下错误

Could not find implicit value for parameter tt: slick.ast.TypedType[List[List[Int]]]

Try slick-pg 尝试slick-pg

import com.github.tminglei.slickpg._

trait MyPostgresProfile extends ExPostgresProfile
  with PgArraySupport
  with PgDate2Support
  with PgRangeSupport
  with PgHStoreSupport
//with PgPlayJsonSupport
  with PgSearchSupport
//with PgPostGISSupport
  with PgNetSupport
  with PgLTreeSupport {
  def pgjson = "jsonb" // jsonb support is in postgres 9.4.0 onward; for 9.3.x use "json"

// Add back `capabilities.insertOrUpdate` to enable native `upsert` support; for postgres 9.5+
//override protected def computeCapabilities: Set[Capability] =
//  super.computeCapabilities + JdbcProfile.capabilities.insertOrUpdate

  override val api = MyAPI

  object MyAPI extends API with ArrayImplicits
    with DateTimeImplicits
//  with JsonImplicits
    with NetImplicits
    with LTreeImplicits
    with RangeImplicits
    with HStoreImplicits
    with SearchImplicits
    with SearchAssistants {
    implicit val intListTypeMapper = new SimpleArrayJdbcType[Int]("integer").to(_.toList)
    implicit val intListListTypeMapper = new AdvancedArrayJdbcType[List[Int]]("integer[]",
      utils.SimpleArrayUtils.fromString[List[Int]](s => 
        scala.util.Try(s.substring(5, s.length - 1).split(",").map(_.trim.toInt).toList).getOrElse(List())
      )(_).orNull,
      utils.SimpleArrayUtils.mkString[List[Int]](_.toString)
    ).to(_.toList)
  }
}

object MyPostgresProfile extends MyPostgresProfile

import MyPostgresProfile.api._

case class Something(name: String, bbox: List[List[Int]])

class SomethingTable(tag: Tag) extends Table[Something](tag, "Something") {
  def name = column[String]("name", O.PrimaryKey)
  def bbox = column[List[List[Int]]]("bbox")

  def * = (name, bbox) <> (Something.tupled, Something.unapply)
}

val query = TableQuery[SomethingTable]

In build.sbt one should add build.sbt应该添加

libraryDependencies += "com.github.tminglei" %% "slick-pg" % "0.16.2"

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

相关问题 Slick 3.0.3错误:找不到参数rconv的隐式值 - Slick 3.0.3 error: could not find implicit value for parameter rconv slick.jdbc.SetParameter[List[Int]] 的隐含值 - implicit value for slick.jdbc.SetParameter[List[Int]] 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 使用slick-pg缺少隐式TypedType [JsonString] - Missing implicit TypedType[JsonString] with slick-pg 无法找到参数的隐含值 - Could not find implicit value for parameter 错误:找不到参数 d 的隐式值:io.circe.Decoder[List[TableInfo]] - error: could not find implicit value for parameter d: io.circe.Decoder[List[TableInfo]] scalaz List [StateT] .sequence - 找不到参数n的隐式值:scalaz.Applicative - scalaz List[StateT].sequence - could not find implicit value for parameter n: scalaz.Applicative 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
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM