20 lines
455 B
Go
20 lines
455 B
Go
package mohong
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
// ChatNotifier 会话创建后的异步通知接口。
|
|
type ChatNotifier interface {
|
|
NotifyNewConversation(conversationID uint64)
|
|
}
|
|
|
|
// Repository 摸大红数据访问。
|
|
type Repository struct {
|
|
db *gorm.DB
|
|
chatNotifier ChatNotifier
|
|
}
|
|
|
|
// NewRepository 创建仓库。
|
|
func NewRepository(db *gorm.DB, chatNotifier ChatNotifier) *Repository {
|
|
return &Repository{db: db, chatNotifier: chatNotifier}
|
|
}
|