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"....")