DBIO.from
!!! non db db slick DBIO DBIO.from
, " " , DBIO db.
DBIO.from . . DBIO.from DBIOAction. db -db db .
def updateElasticCache: Future[Unit] = Future(doSomething())
, db
def createUser(user: User): DBIO[Int] = ???
, createUser , .
val action = createUser.flatMap { _ => DBIO.from(updateElasticCache()) }.transactionally
db.run(action)
, updateElasticCache tx, .
, .
def updateStats: DBIO[Int] = ???
val rollbackActions =
(for {
cStatus <- createUser()
uStatus <- updateStats()
result <- DBIO.from(updateElasticCache())
} yield result).transactionally
db.run(rollbackActions)
, updateElasticCache