import
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
// =====================================================
|
||||
// Общие интерфейсы — один пакет, все потребители импортируют.
|
||||
// Как в Java/Spring: один UserRepository на весь проект.
|
||||
//
|
||||
// Каждый интерфейс определён ОДИН РАЗ и переиспользуется всеми.
|
||||
// В отличие от Go-идиомы, где каждый потребитель определяет свой.
|
||||
// =====================================================
|
||||
|
||||
// Инфраструктура
|
||||
|
||||
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{}
|
||||
Reference in New Issue
Block a user