diff options
author | vlad <vlad@drivergrp.com> | 2016-12-05 11:12:55 -0800 |
---|---|---|
committer | vlad <vlad@drivergrp.com> | 2016-12-05 11:12:55 -0800 |
commit | ce866e5539b4ba6acd46a1d7f2c60f40f481d375 (patch) | |
tree | 76c3974733cbf088c6305e95b28f3e3e4235a449 /src/main/scala/xyz/driver/core/database.scala | |
parent | 18f21d9438ccb39f0cd567f5a0e83cbb3427488f (diff) | |
download | driver-core-0.9.23.tar.gz driver-core-0.9.23.tar.bz2 driver-core-0.9.23.zip |
Useful abstractions to craft DALsv0.9.23
Diffstat (limited to 'src/main/scala/xyz/driver/core/database.scala')
-rw-r--r-- | src/main/scala/xyz/driver/core/database.scala | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/main/scala/xyz/driver/core/database.scala b/src/main/scala/xyz/driver/core/database.scala index 3f4af40..d948be7 100644 --- a/src/main/scala/xyz/driver/core/database.scala +++ b/src/main/scala/xyz/driver/core/database.scala @@ -64,7 +64,6 @@ object database { implicit val monadT: Monad[T] def execute[D](operations: T[D]): Future[D] - def executeTransaction[D](operations: T[D]): Future[D] def noAction[V](v: V): T[V] def customAction[R](action: => Future[R]): T[R] } @@ -79,10 +78,9 @@ object database { override def bind[A, B](fa: T[A])(f: A => T[B]): T[B] = fa.flatMap(a => f(a.asInstanceOf[A])) } - def execute[D](operations: T[D]): Future[D] = operations.asInstanceOf[Future[D]] - def executeTransaction[D](operations: T[D]): Future[D] = operations.asInstanceOf[Future[D]] - def noAction[V](v: V): T[V] = Future.successful(v) - def customAction[R](action: => Future[R]): T[R] = action + def execute[D](operations: T[D]): Future[D] = operations.asInstanceOf[Future[D]] + def noAction[V](v: V): T[V] = Future.successful(v) + def customAction[R](action: => Future[R]): T[R] = action } class SlickDal(database: Database, executionContext: ExecutionContext) extends Dal { @@ -97,11 +95,7 @@ object database { override def bind[A, B](fa: T[A])(f: A => T[B]): T[B] = fa.flatMap(a => f(a.asInstanceOf[A])) } - def execute[D](operations: T[D]): Future[D] = { - database.database.run(operations.asInstanceOf[slick.dbio.DBIO[D]]) - } - - def executeTransaction[D](readOperations: T[D]): Future[D] = { + def execute[D](readOperations: T[D]): Future[D] = { database.database.run(readOperations.asInstanceOf[slick.dbio.DBIO[D]].transactionally) } |