Created
November 6, 2018 14:52
-
-
Save phongngtuan/76f0e3bed00f86614ff0d1d7985b8c1f to your computer and use it in GitHub Desktop.
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
val doobieVersion = "0.6.0" | |
import $ivy.`org.tpolecat:doobie-core_2.12:0.6.0` | |
import $ivy.`org.tpolecat:doobie-postgres_2.12:0.6.0` | |
import $ivy.`org.tpolecat:doobie-specs2_2.12:0.6.0` | |
import doobie._ | |
import doobie.implicits._ | |
import cats._ | |
import cats.data._ | |
import cats.effect.IO | |
import cats.implicits._ | |
import scala.concurrent.ExecutionContext | |
// We need a ContextShift[IO] before we can construct a Transactor[IO]. The passed ExecutionContext | |
// is where nonblocking operations will be executed. | |
implicit val cs = IO.contextShift(ExecutionContext.global) | |
// A transactor that gets connections from java.sql.DriverManager and excutes blocking operations | |
// on an unbounded pool of daemon threads. See the chapter on connection handling for more info. | |
val xa = Transactor.fromDriverManager[IO]( | |
"org.postgresql.Driver", // driver classname | |
"jdbc:postgresql:world", // connect URL (driver-specific) | |
"postgres", // user | |
"" // password | |
) | |
val y = xa.yolo | |
import y._ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment