Created
January 11, 2017 17:31
-
-
Save Christewart/591061ba6cbe2bff03b6c31860984458 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Updates all of the given ts in the database */ | |
def updateAll(ts: Seq[T]): Future[Seq[T]] = { | |
val query = findAll(ts) | |
val actions = ts.map(t => query.update(t)) | |
val affectedRows: Future[Seq[Int]] = database.run(DBIO.sequence(actions)) | |
val updatedTs = findAll(ts) | |
affectedRows.flatMap { _ => | |
database.run(updatedTs.result) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment