Using transactionally in Slick 3

ساخت وبلاگ

Vote count: 0

Usually you would run two or more statements in a transaction. But in all the examples I could find on using transactionally in Slick 3, there's a for/yield statement to group these statements, when I usually use for in a loop.

This works (deleting from two tables in a transaction):

 val action = db.run((for { _ <- table1.filter(_.id1 === id).delete _ <- table2.filter(_.id2=== id).delete } yield ()).transactionally) val result = Await.result(action, Duration.Inf)

But is the for/yield needed? is there an alteative way just to run two or more statements in a transaction?

asked 2 mins ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 106 تاريخ : پنجشنبه 30 ارديبهشت 1395 ساعت: 8:07