Files
gochat/internal/service/search_indexer.go
T

30 lines
1.1 KiB
Go

package service
import (
"context"
"github.com/gochat/gochat/internal/model"
applogger "github.com/gochat/gochat/pkg/logger"
)
// SearchIndexer is the service-layer boundary for search synchronization.
// Implementations may index synchronously or enqueue durable jobs later.
type SearchIndexer interface {
IndexConversation(ctx context.Context, conversation *model.Conversation) error
DeleteConversation(ctx context.Context, accountID uint, id uint) error
IndexMessage(ctx context.Context, message *model.Message) error
DeleteMessage(ctx context.Context, accountID uint, id uint) error
IndexContact(ctx context.Context, contact *model.Contact) error
DeleteContact(ctx context.Context, accountID uint, id uint) error
IndexCompany(ctx context.Context, company *model.Company) error
DeleteCompany(ctx context.Context, accountID uint, id uint) error
IndexArticle(ctx context.Context, article *model.Article) error
DeleteArticle(ctx context.Context, accountID uint, id uint) error
}
func logSearchIndexError(entity string, id uint, err error) {
if err != nil {
applogger.L().Warnf("search index sync failed for %s %d: %v", entity, id, err)
}
}