scalaquery-examples 项目中的FirstExample 提供了一个批量插入的示例,语法如下:
Coffees.insertAll(
("Colombian", 101, 7.99, 0, 0),
("French_Roast",49, 8.99, 0, 0),
("Espresso",150, 9.99, 0, 0),
("Colombian_Decaf",101, 8.99, 0, 0),
("French_Roast_Decaf", 49, 9.99, 0, 0)
)
鉴于对于此示例,函数定义为:如何在 InsertAll 方法中传递动态构造的元组列表:
def insertAll(values: (String, Int, Double, Int, Int)*)(implicit session: org.scalaquery.session.Session): Option[Int]