thread-master/apps/backend/internal/module/inspire/domain/repository.go

24 lines
1.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package domain
import "context"
type Repository interface {
// Trends are global-ish; refresh rewrites owner's view cache
ListTrends(ctx context.Context, ownerUID int64) ([]*TrendItem, error)
SaveTrends(ctx context.Context, ownerUID int64, items []*TrendItem) error
ListElements(ctx context.Context, ownerUID int64) ([]*Element, error)
SaveElement(ctx context.Context, e *Element) error
DeleteElement(ctx context.Context, id string) error
GetElement(ctx context.Context, id string) (*Element, error)
// Sessions — 多對話GetSession 回 active無則建新
ListSessions(ctx context.Context, ownerUID int64) ([]*Session, error)
GetSession(ctx context.Context, ownerUID int64) (*Session, error) // active
GetSessionByID(ctx context.Context, ownerUID int64, id string) (*Session, error)
SaveSession(ctx context.Context, s *Session) error
DeleteSessionByID(ctx context.Context, ownerUID int64, id string) error
GetActiveSessionID(ctx context.Context, ownerUID int64) (string, error)
SetActiveSessionID(ctx context.Context, ownerUID int64, sessionID string) error
}