Created
April 5, 2022 06:44
-
-
Save supermanue/4cf86de4a938dd897edc0f9abd03d79f to your computer and use it in GitHub Desktop.
Transactor
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
import doobie.h2.H2Transactor | |
import scala.concurrent.ExecutionContext | |
import zio.Task | |
import zio.interop.catz._ | |
object DoobiePersistenceService { | |
def mkTransactor( | |
conf: DbConfig, | |
connectEC: ExecutionContext, | |
transactEC: ExecutionContext | |
): Managed[Throwable, Transactor[Task]] = { | |
H2Transactor | |
.newH2Transactor[Task](conf.url, conf.user, conf.password, connectEC, Blocker.liftExecutionContext(transactEC)) | |
.toManagedZIO | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment