Files
lincodex/backend/internal/bootstrap/wire_gen.go
T

68 lines
1.9 KiB
Go

// Code generated by Wire. DO NOT EDIT.
//go:generate go run -mod=mod github.com/goforj/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package bootstrap
import (
"context"
"lincodex/backend/config"
"lincodex/backend/internal/adapter/primary/http"
"lincodex/backend/internal/adapter/primary/http/v1"
"lincodex/backend/internal/adapter/secondary/postgres"
"lincodex/backend/internal/adapter/secondary/prometheus"
"lincodex/backend/internal/adapter/secondary/redis"
"lincodex/backend/internal/adapter/secondary/seaweedfs"
"lincodex/backend/internal/port/inbound"
"lincodex/backend/internal/usecase/health"
"log/slog"
)
// Injectors from wire.go:
func initialize(ctx context.Context, config2 config.Config, logger *slog.Logger) (*Application, func(), error) {
healthChecker, cleanup, err := postgres.NewHealthChecker(ctx, config2)
if err != nil {
return nil, nil, err
}
cache, cleanup2, err := redis.NewCache(config2, logger)
if err != nil {
cleanup()
return nil, nil, err
}
storage, cleanup3, err := seaweedfs.NewStorage(config2)
if err != nil {
cleanup2()
cleanup()
return nil, nil, err
}
readiness := newReadiness(healthChecker, cache, storage)
healthHandler := newHealthHandler(readiness, config2)
metrics := prometheus.New()
handler, err := httpadapter.NewRouter(healthHandler, metrics, logger)
if err != nil {
cleanup3()
cleanup2()
cleanup()
return nil, nil, err
}
application := NewApplication(config2, handler, metrics, logger)
return application, func() {
cleanup3()
cleanup2()
cleanup()
}, nil
}
// wire.go:
func newHealthHandler(readiness inbound.Readiness, config2 config.Config) *v1.HealthHandler {
return v1.NewHealthHandler(readiness, config2.ReadinessTimeout)
}
func newReadiness(postgres2 *postgres.HealthChecker, cache *redis.Cache, storage *seaweedfs.Storage) *health.Readiness {
return health.NewReadiness(postgres2, cache, storage)
}