Skip to content

Instantly share code, notes, and snippets.

@adamw adamw/t11.scala
Last active Sep 20, 2019

What would you like to do?
val countPersons: ConnectionIO[Int] =
sql"SELECT COUNT(*) FROM persons".query[Int].unique
val callFromCount: ConnectionIO[IO[Unit]] = { count =>
if (count == 0) IO(println("No users!")) else IO(println(s"Found $count users"))
val showResults: IO[Unit] = callFromCount.transact(transactor).flatten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.