Created
July 17, 2023 05:33
-
-
Save DenisNovac/3cc4f4606c78b5823eb52aefbbb63cb2 to your computer and use it in GitHub Desktop.
Pure doobie Transactor for mocking ConnectionIO
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
// https://github.com/tpolecat/doobie/issues/460 | |
object Test { | |
import cats.implicits._ | |
import cats.effect.IO | |
import cats.effect.unsafe.implicits.global | |
import doobie.{ConnectionIO, Transactor} | |
import doobie.implicits._ | |
val u = ().pure[ConnectionIO] | |
val s = doobie.util.transactor.Strategy(u, u, u, u) | |
val noopXa = Transactor.fromConnection[IO](null).copy(strategy0 = s) | |
val value: ConnectionIO[Int] = 42.pure[ConnectionIO] | |
val r = value.transact(noopXa).unsafeRunSync() | |
} | |
Test.r // 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment