scala - Insert Sequence into Database, Slick 3 -


i want add method daos allow me insert list of elements rather single element, single element have:

def add(usergroup: usergroup): future[int] = {   dbconfig.db.run(usergroups += usergroup) } 

the documentation seems suggest should able use ++= so

def add(usergroups: seq[usergroup]): future[int] = {   dbconfig.db.run(usergroups ++= usergroups) } 

http://slick.typesafe.com/doc/3.0.0/queries.html#inserting

but doesn't work, ++= isn't expects apparently?

++= added sequence tablequery. second snippet, looks adding usergroups: seq[usergroup] rather tablequery instance.

if first snippet works, adding usergroups: seq[usergroup] this.usergroups work.

def add(usergroups: seq[usergroup]): future[int] = {   dbconfig.db.run(this.usergroups ++= usergroups) } 

Comments