Files
di-container/cmd/fx-di-modules/interfaces.go
T
2026-04-13 08:14:09 +03:00

38 lines
929 B
Go

package main
// Общие интерфейсы — один пакет, все потребители импортируют.
// Как в Java/Spring: один UserRepository на весь проект.
// fx.Module работает красиво именно с таким подходом.
// Инфраструктура
type DB interface {
Query(query string) error
QueryRow(query string) error
Exec(query string) error
BeginTx() error
BulkInsert(query string, args ...any) error
}
type Cache interface {
Get(key string) (string, error)
Set(key, value string) error
}
type EventBus interface {
Publish(event string)
Subscribe(event string, handler func())
}
// Репозитории
type UserRepository interface{}
type SessionRepository interface{}
type NotificationRepository interface{}
// Сервисы
type AuthService interface{}
type UserService interface{}
type NotificationService interface{}