1

The FirstExample in scalaquery-examples project provides an example of batch insert with the following Syntax:

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

How is it possible to pass a dynamically constructed List of tuples in the InsertAll method given that for this example the function definition is:

def insertAll(values: (String, Int, Double, Int, Int)*)(implicit session: org.scalaquery.session.Session): Option[Int]
krishnen
  • 172
  • 1
  • 1
  • 9

1 Answers1

3

You can transform your List to variable-length arguments like this:

insertAll(tuplesList.toSeq:_*)
om-nom-nom
  • 62,329
  • 13
  • 183
  • 228