我有一个在普通 sql 中看起来像这样的查询
Select * from persons
where (persons.first_name, persons.last_name)
in (('a', 'b'), ('c', 'd'))
我正在尝试从 scala 中执行此操作
val names = List(("James", "hasi"), ("Michael", "Myers))
sql""" Select * from ${table} where (first_name, last_name) IN ${names}""".stripMargin.map(...)
但是它失败了,因为 scalikejdbc 不知道如何插入元组。
"PSQLException: Can't infer the SQL type to use for an instance scala.Tuple2"
知道如何实现吗?我想我总是可以将元组列表转换为字符串,但问题是 scala 会用单引号将它包装起来,将所有内容都作为字符串处理。