Files
di-container/cmd/fx-di-modules/user_module.go
T

37 lines
929 B
Go
Raw Normal View History

2026-04-13 08:14:09 +03:00
package main
// Домен профилей пользователей.
// Этим файлом владеет команда профилей.
//
// Что внутри: пользователи, профили, настройки.
// Что НЕ знает: как устроена авторизация внутри, как устроены уведомления.
import "go.uber.org/fx"
var UserModule = fx.Module("user",
fx.Provide(
newUserRepo,
newUserService,
),
)
// --- UserRepo ---
type userRepo struct{ db DB }
func newUserRepo(db DB) UserRepository {
return &userRepo{db: db}
}
// --- UserService ---
type userServiceImpl struct {
userRepo UserRepository
authService AuthService
events EventBus
}
func newUserService(userRepo UserRepository, authService AuthService, events EventBus) UserService {
return &userServiceImpl{userRepo: userRepo, authService: authService, events: events}
}