Files
EchoChat/backend/go-service/app/provider/wire_gen.go
bujinyuan 2c7be494f2 feat(im): Task 5 - IM REST Controller + Router + Wire 集成
IMController (REST API):
- GET /api/v1/im/conversations: 会话列表
- GET /api/v1/im/messages: 历史消息(游标分页)
- PUT /api/v1/im/conversations/:id/pin: 置顶/取消
- DELETE /api/v1/im/conversations/🆔 删除会话
- DELETE /api/v1/im/conversations/:id/messages: 清空记录
- GET /api/v1/im/messages/search: 全局搜索
- GET /api/v1/im/unread: 全局未读数

Wire 集成:
- IMSet Provider Set + wire.Bind 接口注入
- App struct 新增 IM 字段
- wire_gen.go 手动更新
- OfflinePusher 通过 SetOfflinePusher 注入 WS Handler

Made-with: Cursor
2026-03-03 10:51:56 +08:00

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)
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
}