Scala 找不到参数tt:slick.ast.TypedType[List[List[Int]]的隐式值
在postgres中,我试图使用slick 3.2映射integer[][]类型的列 当试图定义以下内容时Scala 找不到参数tt:slick.ast.TypedType[List[List[Int]]的隐式值,scala,slick,slick-3.0,Scala,Slick,Slick 3.0,在postgres中,我试图使用slick 3.2映射integer[][]类型的列 当试图定义以下内容时 def bbox = column[List[List[Int]]]("bbox") 我得到以下错误 Could not find implicit value for parameter tt: slick.ast.TypedType[List[List[Int]]] 试一试 scala.util.Try(s.substring(1,s.length-1)、split(“,”).ma
def bbox = column[List[List[Int]]]("bbox")
我得到以下错误
Could not find implicit value for parameter tt: slick.ast.TypedType[List[List[Int]]]
试一试
scala.util.Try(s.substring(1,s.length-1)、split(“,”).map(u.trim.toInt).toList.getOrElse(List())“List”(“是前5个字符,”)是最后一个字符。为什么我们要从第5个字符而不是第一个字符开始执行子字符串?因为前5个字符是“List(”.Found slickpg已经这样实现了它。隐式val intintintwitness=ElemWitness.AnyWitness.asInstanceOf[ElemWitness[List[Int]]]隐式val simpleintitListTypeMapper=new SimpleArrayJdbcType[List[Int]](“Int[])。to(.asInstanceOf[Seq[Array[Any]]]]。toList.map(.toList.asInstanceOf[列表[Int]])
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]
libraryDependencies += "com.github.tminglei" %% "slick-pg" % "0.16.2"