Skip to content

Instantly share code, notes, and snippets.

@lforite
Created December 11, 2019 09:34
Show Gist options
  • Select an option

  • Save lforite/ee813564cf4fc4c5835974598091c06f to your computer and use it in GitHub Desktop.

Select an option

Save lforite/ee813564cf4fc4c5835974598091c06f to your computer and use it in GitHub Desktop.
trait ServiceA {
def createA(a: EntityA): RIO[_]
}
trait ClientB {
def getB(bId: EntityBID): RIO[_]
}
case class ServiceA(clientB: ClientB) extends ServiceA {
override def createA(a: EntityA): RIO[_] = {
for {
entityB <- clientB.getB(a.idOfB)
processed <- somePrivateBusinessLogic(entityB)
result <- someMoreBusinessLogic(processed)
_ <- logger.info(s"Successfully processed entity ${a.id}")
} yield result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment