Files
EchoChat/backend/go-service/app/provider/wire_gen.go

73 lines
3.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Code generated by Wire. DO NOT EDIT.
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package provider
import (
controller2 "github.com/echochat/backend/app/admin/controller"
dao2 "github.com/echochat/backend/app/admin/dao"
service2 "github.com/echochat/backend/app/admin/service"
"github.com/echochat/backend/app/auth/controller"
"github.com/echochat/backend/app/auth/dao"
"github.com/echochat/backend/app/auth/service"
controller3 "github.com/echochat/backend/app/contact/controller"
dao3 "github.com/echochat/backend/app/contact/dao"
service3 "github.com/echochat/backend/app/contact/service"
imApp "github.com/echochat/backend/app/im"
"github.com/echochat/backend/app/ws"
"github.com/echochat/backend/config"
"github.com/echochat/backend/pkg/db"
)
// Injectors from wire.go:
// InitializeApp 初始化整个应用Wire 自动生成实现)
func InitializeApp(cfg *config.Config) (*App, error) {
databaseConfig := provideDBConfig(cfg)
gormDB, err := db.NewPostgres(databaseConfig)
if err != nil {
return nil, err
}
redisConfig := provideRedisConfig(cfg)
client, err := db.NewRedis(redisConfig)
if err != nil {
return nil, err
}
userDAO := dao.NewUserDAO(gormDB)
roleDAO := dao.NewRoleDAO(gormDB)
jwtConfig := provideJWTConfig(cfg)
tokenStore := service.NewTokenStore(client, jwtConfig)
authService := service.NewAuthService(userDAO, roleDAO, jwtConfig, tokenStore)
authController := controller.NewAuthController(authService)
adminAuthController := controller.NewAdminAuthController(authService)
userManageDAO := dao2.NewUserManageDAO(gormDB)
userManageService := service2.NewUserManageService(userManageDAO, userDAO, roleDAO)
userManageController := controller2.NewUserManageController(userManageService)
hub := ws.ProvideHub()
pubSub := ws.ProvidePubSub(client, hub)
friendshipDAO := dao3.NewFriendshipDAO(gormDB)
onlineService := ws.ProvideOnlineService(client, hub, pubSub, friendshipDAO)
onlineManageService := service2.NewOnlineManageService(onlineService, gormDB)
onlineController := controller2.NewOnlineController(onlineManageService)
contactManageService := service2.NewContactManageService(gormDB)
contactManageController := controller2.NewContactManageController(contactManageService)
handler := ws.ProvideWSHandler(hub, pubSub, jwtConfig, onlineService, authService)
friendGroupDAO := dao3.NewFriendGroupDAO(gormDB)
contactService := service3.NewContactService(friendshipDAO, friendGroupDAO, pubSub, onlineService)
contactController := controller3.NewContactController(contactService)
// IM 模块初始化
conversationDAO := imApp.ProvideConversationDAO(gormDB)
messageDAO := imApp.ProvideMessageDAO(gormDB)
imService := imApp.ProvideIMService(conversationDAO, messageDAO, pubSub, client, friendshipDAO, friendshipDAO)
imEventHandler := imApp.ProvideIMEventHandler(imService, hub)
offlinePusher := imApp.ProvideOfflinePusher(imService, conversationDAO, pubSub)
imController := imApp.ProvideIMController(imService)
app := NewApp(cfg, gormDB, client, authService, authController, adminAuthController, userManageController, onlineController, contactManageController, handler, hub, pubSub, onlineService, contactController, imController, imEventHandler, offlinePusher)
return app, nil
}