如何在Scala中链接它?

如何在Scala中链接它?,scala,slick,implicit-conversion,slick-3.0,implicits,Scala,Slick,Implicit Conversion,Slick 3.0,Implicits,有一个例子讨论了隐式的链接,但我认为它不包括我的情况,因为我有泛型隐式。演示问题所在位置的示例项目。要复制,应注释掉两行 所以我有很多具体类型的隐式,比如 implicit val ObjectIdColumnType: ColumnType[ObjectId] = MappedColumnType.base[ObjectId, Array[Byte]]( { obj => obj.toByteArray }, { arr => new ObjectId(arr) }

有一个例子讨论了隐式的链接,但我认为它不包括我的情况,因为我有泛型隐式。演示问题所在位置的示例项目。要复制,应注释掉两行

所以我有很多具体类型的隐式,比如

implicit val ObjectIdColumnType: ColumnType[ObjectId] = MappedColumnType.base[ObjectId, Array[Byte]](
      { obj => obj.toByteArray }, { arr => new ObjectId(arr) }
    )
我希望它们都能自动生成
GetResult[T]
隐式VAL。因此,我编写了以下函数

implicit def getResultForTypedTypes[T](implicit bct: ColumnType[T]): GetResult[T] =
  GetResult[T](r => bct.getValue(r.rs, r.currentPos))
我希望原型能够实现这个功能,比如

def << [T](implicit f: GetResult[T]): T = f(this)
我启用了log implicits,发现看似无关的implicit在某种程度上

Information:(78, 20) getResultForTypedTypes is not a valid implicit value for slick.jdbc.GetResult[org.bson.types.ObjectId] because:
hasMatchingSymbol reported error: ambiguous implicit values:
 both value strListTypeMapper in object MyAPI of type => co.greenhouse.rabbit.server.db.MyPostgresDriver.DriverJdbcType[List[String]]
 and value ObjectIdColumnType in object MyAPI of type => co.greenhouse.rabbit.server.db.MyPostgresDriver.BaseColumnType[org.bson.types.ObjectId]
 match expected type co.greenhouse.rabbit.server.db.MyPostgresDriver.api.BaseColumnType[T]
      val id = r.<<[ObjectId]
                   ^
信息:(78,20)getResultForTypedTypes不是slick.jdbc.GetResult[org.bson.types.ObjectId]的有效隐式值,因为:
hasMatchingSymbol报告错误:不明确的隐式值:
类型=>co.greenouse.rabbit.server.db.MyPostgresDriver.DriverJdbcType[List[String]]的对象MyAPI中的两个值strListTypeMapper
类型=>co.greenouse.rabbit.server.db.MyPostgresDriver.BaseColumnType[org.bson.types.ObjectId]的对象MyAPI中的值ObjectdColumnType
匹配预期的类型co.greenouse.rabbit.server.db.MyPostgresDriver.api.BaseColumnType[T]

val id=r。从我所看到的
DriverJdbcType
BaseColumnType
的一个子类型。这仍然不能解释
列表[String]
但是。。。
Information:(78, 20) getResultForTypedTypes is not a valid implicit value for slick.jdbc.GetResult[org.bson.types.ObjectId] because:
hasMatchingSymbol reported error: ambiguous implicit values:
 both value strListTypeMapper in object MyAPI of type => co.greenhouse.rabbit.server.db.MyPostgresDriver.DriverJdbcType[List[String]]
 and value ObjectIdColumnType in object MyAPI of type => co.greenhouse.rabbit.server.db.MyPostgresDriver.BaseColumnType[org.bson.types.ObjectId]
 match expected type co.greenhouse.rabbit.server.db.MyPostgresDriver.api.BaseColumnType[T]
      val id = r.<<[ObjectId]
                   ^