Created
September 19, 2019 16:11
-
-
Save adamw/367f7a0e8fab9e346581be1ab1a48009 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def insertPerson(p: Person): ConnectionIO[Int] = | |
sql"INSERT INTO persons(name, age) VALUES(${p.name}, ${p.age})".update.run | |
def countPersons: ConnectionIO[Int] = | |
sql"SELECT COUNT(*) FROM persons".query[Int].unique | |
val insertAndCount = | |
insertPerson(Person("Pedro", 81)).flatMap(_ => countPersons) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment