0
我有一個簡單的功能,我想用後綴符號來調用爲什麼我不能使用後綴符號此功能
import anorm._
class SimpleRepository {
private def run(sql: SimpleSql[Row]) = sql.as(SqlParser.scalar[String].*)
// this is how i'd like to call the method
def getColors(ids: Seq[UUUID])(implicit conn: Connection) = run SQL"""select color from colors where id in $ids"""
def getFlavors(ids: Seq[UUID])(implicit conn: Connection) = run SQL"""select flavor from flavors where id in $ids"""
}
的IntelliJ抱怨Expression of type SimpleSql[Row] does not conform to expected type A_
當我嘗試編譯我出現以下錯誤
...';' expected but string literal found.
[error] run SQL"""....
它的工作原理,如果我附上的參數在括號run
預期,即
getColors(ids: Seq[UUID](implicit conn: Connection) = run(SQL"....")