Skip to content

Instantly share code, notes, and snippets.

@emag
Created December 9, 2024 00:15
Show Gist options
  • Save emag/d0025c6674940c791127171bcabf7646 to your computer and use it in GitHub Desktop.
Save emag/d0025c6674940c791127171bcabf7646 to your computer and use it in GitHub Desktop.
バックエンドの定義
object BalanceSheetApp {
given BackendCodec[BsEvent] = CirceCodec.json
given BackendCodec[BsNotification] = CirceCodec.json
given BackendCodec[BalanceSheet] = CirceCodec.json
def backend[F[_]: Async](pool: Resource[F, Session[F]]) = Backend
.builder(BalanceSheetService)
.use(SkunkDriver("edomata_kakeibo", pool))
.build
def apply[F[_]: Async](pool: Resource[F, Session[F]]) =
backend(pool).map(s =>
new BalanceSheetApp(s, s.compile(BalanceSheetService[F]))
)
}
final case class BalanceSheetApp[F[_]](
storage: eventsourcing.Backend[
F,
BalanceSheet,
BsEvent,
BsRejection,
BsNotification
],
service: BalanceSheetService.Handler[F]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment