0
下面的代碼失敗,因爲「無法找到RS隱含價值」:Implicits不工作
import scalikejdbc.WrappedResultSet
object DatabaseSupport {
implicit class WrappedResultSetConverter(columnName: String)(implicit rs: WrappedResultSet) extends AnyRef {
def stringCol: String = rs.string(columnName)
def intCol: Int = rs.int(columnName)
}
def myTest(rsParam: WrappedResultSet) {
val a: String = "name".stringCol
val b: String = WrappedResultSetConverter("name").stringCol
}
}
我曾認爲rsParam參數MYTEST是將implicits可見?
您不需要擴展AnyRef – Luciano