-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmain.go
35 lines (28 loc) · 1 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"github.com/stackus/ftgogo/delivery/internal/adapters"
"github.com/stackus/ftgogo/delivery/internal/application"
"github.com/stackus/ftgogo/delivery/internal/handlers"
"github.com/stackus/ftgogo/serviceapis"
"shared-go/applications"
)
func main() {
svc := applications.NewService(initService)
if err := svc.Execute(); err != nil {
panic(err)
}
}
func initService(svc *applications.Service) error {
serviceapis.RegisterTypes()
// Driven
courierRepo := adapters.NewCourierPostgresRepository(svc.PgConn)
deliveryRepo := adapters.NewDeliveryPostgresRepository(svc.PgConn)
restaurantRepo := adapters.NewRestaurantPostgresRepository(svc.PgConn)
app := application.NewServiceApplication(courierRepo, deliveryRepo, restaurantRepo)
// Drivers
handlers.NewRestaurantEventHandlers(app).Mount(svc.Subscriber)
handlers.NewOrderEventHandlers(app).Mount(svc.Subscriber)
handlers.NewTicketEventHandlers(app).Mount(svc.Subscriber)
handlers.NewRpcHandlers(app).Mount(svc.RpcServer)
return nil
}