123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //go:build wireinject
- // +build wireinject
- package wire
- import (
- "github.com/go-nunu/nunu-layout-advanced/internal/handler"
- "github.com/go-nunu/nunu-layout-advanced/internal/repository"
- "github.com/go-nunu/nunu-layout-advanced/internal/server"
- "github.com/go-nunu/nunu-layout-advanced/internal/service"
- "github.com/go-nunu/nunu-layout-advanced/pkg/app"
- "github.com/go-nunu/nunu-layout-advanced/pkg/helper/sid"
- "github.com/go-nunu/nunu-layout-advanced/pkg/jwt"
- "github.com/go-nunu/nunu-layout-advanced/pkg/log"
- "github.com/go-nunu/nunu-layout-advanced/pkg/server/http"
- "github.com/google/wire"
- "github.com/spf13/viper"
- )
- var repositorySet = wire.NewSet(
- repository.NewDB,
- repository.NewRedis,
- repository.NewRepository,
- repository.NewTransaction,
- repository.NewUserRepository,
- )
- var serviceSet = wire.NewSet(
- service.NewService,
- service.NewUserService,
- )
- var handlerSet = wire.NewSet(
- handler.NewHandler,
- handler.NewUserHandler,
- )
- var serverSet = wire.NewSet(
- server.NewHTTPServer,
- server.NewJob,
- server.NewTask,
- )
- // build App
- func newApp(httpServer *http.Server, job *server.Job) *app.App {
- return app.NewApp(
- app.WithServer(httpServer, job),
- app.WithName("demo-server"),
- )
- }
- func NewWire(*viper.Viper, *log.Logger) (*app.App, func(), error) {
- panic(wire.Build(
- repositorySet,
- serviceSet,
- handlerSet,
- serverSet,
- sid.NewSid,
- jwt.NewJwt,
- newApp,
- ))
- }
|