Created
December 9, 2024 00:15
-
-
Save emag/d0025c6674940c791127171bcabf7646 to your computer and use it in GitHub Desktop.
バックエンドの定義
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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