Skip to content

Instantly share code, notes, and snippets.

@jczuchnowski
Created August 4, 2019 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jczuchnowski/3bded5747019bcdd7281c918ac765b1c to your computer and use it in GitHub Desktop.
Save jczuchnowski/3bded5747019bcdd7281c918ac765b1c to your computer and use it in GitHub Desktop.
def fromDBIO[R](dbio: DBIO[R]): ZIO[DatabaseProvider, Throwable, R] =
for {
db <- ZIO.accessM[DatabaseProvider](_.databaseProvider.db)
r <- ZIO.fromFuture(ec => db.run(dbio))
} yield r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment