123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- //go:build wireinject
- // +build wireinject
- package wire
- import (
- "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/task"
- "github.com/go-nunu/nunu-layout-advanced/pkg/app"
- "github.com/go-nunu/nunu-layout-advanced/pkg/log"
- "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 taskSet = wire.NewSet(
- task.NewTask,
- task.NewUserTask,
- )
- var serverSet = wire.NewSet(
- server.NewTaskServer,
- )
- // build App
- func newApp(
- task *server.TaskServer,
- ) *app.App {
- return app.NewApp(
- app.WithServer(task),
- app.WithName("demo-task"),
- )
- }
- func NewWire(*viper.Viper, *log.Logger) (*app.App, func(), error) {
- panic(wire.Build(
- repositorySet,
- taskSet,
- serverSet,
- newApp,
- sid.NewSid,
- ))
- }
|