Α
Я щас обычно фигачу везде deferFromFuture - не оч красиво
Size: a a a
Α
ΛВ
ΛВ
AS
val transact = new (DBIO ~> F) {
override def apply[A](dbio: DBIO[A]): F[A] = {
import schema.databaseProfile.api._
deferFuture(_ => db.run(dbio.transactionally))
}
}
Α
val transact = new (DBIO ~> F) {
override def apply[A](dbio: DBIO[A]): F[A] = {
import schema.databaseProfile.api._
deferFuture(_ => db.run(dbio.transactionally))
}
}
AS
trait UserRepo[F[_]] {
def findUserByEmail(email: Email): F[Option[User]]
}
class UserRepoImpl(...) extends UserRepo[DBIO] {
// ...
}
implicit val functorKUserRepo: FunctorK[UserRepo] = Derive.functorK[UserRepo]
userRepoImpl.mapK(transact)
Α
val transact = new (DBIO ~> F) {
override def apply[A](dbio: DBIO[A]): F[A] = {
import schema.databaseProfile.api._
deferFuture(_ => db.run(dbio.transactionally))
}
}
Oℕ
val transact = new (DBIO ~> F) {
override def apply[A](dbio: DBIO[A]): F[A] = {
import schema.databaseProfile.api._
deferFuture(_ => db.run(dbio.transactionally))
}
}
AS
Oℕ
Oℕ
ΛВ
ΛВ
Α
ΛВ
AS
val transact: DBIO ~> F =
funK(dbio => deferFuture( _ => postgresDatabase.run(dbio.transactionally)))
value transactionally is not a member of slick.dbio.DBIO[stabilizer$1.Arbitrary]
funK(dbio => deferFuture( _ => postgresDatabase.run(dbio.transactionally)))
Α
AS
val transact: DBIO ~> F =
funK(dbio => deferFuture( _ => postgresDatabase.run(dbio.transactionally)))
value transactionally is not a member of slick.dbio.DBIO[stabilizer$1.Arbitrary]
funK(dbio => deferFuture( _ => postgresDatabase.run(dbio.transactionally)))
Α
ΛВ