refactor: update repository interfaces and improve dependency injection
- Refactored repository structures to use interfaces instead of concrete types, enhancing flexibility and testability. - Updated various repository methods to accept interfaces, allowing for better dependency management. - Modified wire generation to accommodate new repository interfaces, ensuring proper service injection throughout the application. - Enhanced handler methods to utilize DTOs for filtering and data handling, improving code clarity and maintainability.
This commit is contained in:
8
internal/cache/repository_adapter.go
vendored
8
internal/cache/repository_adapter.go
vendored
@@ -7,11 +7,11 @@ import (
|
||||
|
||||
// ConversationRepositoryAdapter 适配 MessageRepository 到 ConversationRepository 接口
|
||||
type ConversationRepositoryAdapter struct {
|
||||
repo *repository.MessageRepository
|
||||
repo repository.MessageRepository
|
||||
}
|
||||
|
||||
// NewConversationRepositoryAdapter 创建适配器
|
||||
func NewConversationRepositoryAdapter(repo *repository.MessageRepository) ConversationRepository {
|
||||
func NewConversationRepositoryAdapter(repo repository.MessageRepository) ConversationRepository {
|
||||
return &ConversationRepositoryAdapter{repo: repo}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ func (a *ConversationRepositoryAdapter) GetUnreadCount(userID, convID string) (i
|
||||
|
||||
// MessageRepositoryAdapter 适配 MessageRepository 到 MessageRepository 接口
|
||||
type MessageRepositoryAdapter struct {
|
||||
repo *repository.MessageRepository
|
||||
repo repository.MessageRepository
|
||||
}
|
||||
|
||||
// NewMessageRepositoryAdapter 创建适配器
|
||||
func NewMessageRepositoryAdapter(repo *repository.MessageRepository) MessageRepository {
|
||||
func NewMessageRepositoryAdapter(repo repository.MessageRepository) MessageRepository {
|
||||
return &MessageRepositoryAdapter{repo: repo}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user