我还没有弄清楚你的问题,但是插值 Set value 应该可以工作。
libraryDependencies ++= Seq(
"org.scalikejdbc" %% "scalikejdbc" % "2.2.6",
"com.h2database" % "h2" % "1.4.187",
"ch.qos.logback" % "logback-classic" % "1.1.3"
)
像这样:
scala> import scalikejdbc._
import scalikejdbc._
scala> val ids = Set(1,2,3,5)
ids: scala.collection.immutable.Set[Int] = Set(1, 2, 3, 5)
scala> val s = sql"""update foo set bar=1 where id in (${ids})"""
s: scalikejdbc.SQL[Nothing,scalikejdbc.NoExtractor] = scalikejdbc.SQLToTraversableImpl@633229c7
scala> s.statement
res1: String = update foo set bar=1 where id in (?, ?, ?, ?)
scala> s.parameters
res2: Seq[Any] = List(1, 2, 3, 5)