1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- //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/jwt"
- "github.com/go-nunu/nunu-layout-advanced/pkg/log"
- "github.com/go-nunu/nunu-layout-advanced/pkg/server/http"
- "github.com/go-nunu/nunu-layout-advanced/pkg/sid"
- "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,
- )
- // 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,
- ))
- }
|