Skip to content

Instantly share code, notes, and snippets.

@samuelorji
Last active April 9, 2020 17:25
Show Gist options
  • Save samuelorji/5230baa2ea11bdb2d9eaad941694e898 to your computer and use it in GitHub Desktop.
Save samuelorji/5230baa2ea11bdb2d9eaad941694e898 to your computer and use it in GitHub Desktop.
sealed trait DatabaseDriver {
// //A lot of database config we don't care about
// //Database object
lazy val db = new ConnectionPool(_, _)
}
trait PostgresDatabase extends Database with DatabaseDriver {
private def runQuery(query: String): IO[Throwable, QueryResult] = {
for {
result <- ZIO.fromFuture(_ => db.sendPreparedStatement(query))
} yield result
}
//Other Stuff :)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment