This commit is contained in:
2026-04-13 08:14:09 +03:00
commit 0449337ae7
39 changed files with 2726 additions and 0 deletions
+41
View File
@@ -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{}