Slide 36
Slide 36 text
val xa = DriverManagerTransactor[IO](
"org.postgresql.Driver", "jdbc:postgresql:world", "postgres", ""
)
case class Country(code: String, name: String, population: Long)
def find(n: String): ConnectionIO[Option[Country]] =
sql"select code, name from country where name = $n”.query[Country].option
find("France").transact(xa).unsafePerformIO
Some(Country(FRA, France))
Doobie Sample