DRAFT…

Cats in Use with Doobie

I’ve been using cats, http4s, rho and doobie on openshift. The problem is optimistic locking in Doobie where I capture failures in the Dao package rather than propagate up to the http4s layer.

i.e. a simplified function is below

def update(dto:SomeDto) = {
  for {
    rowCnt <- dao.update(dto)
    archiveRowCnt <- dao.updateArchive(dto)
  } yield (rowCnt, archiveRowCnt)
}

How do I only update the archive if the update returned 1 row updated?

Read the Book of Doobie