Versions in this module Expand all Collapse all v0 v0.1.0 Nov 10, 2026 Changes in this version + var ErrConflict = errors.New("event_conflict") + var ErrInput = errors.New("invalid_input") + var ErrNotFound = errors.New("not_found") + var ErrSourceDisabled = errors.New("source_disabled") + var ErrUnauthenticated = errors.New("unauthenticated") + var ErrUnavailable = errors.New("unavailable") + func ActivityID(target Target, day string) string + func Validate(d Document) error + func ValidateActivity(d ActivitySnapshot) error + type ActivityEvent struct + Data ActivitySnapshot + ID string + Source string + SpecVersion string + Subject string + Time time.Time + Type string + type ActivityFilter struct + After string + From time.Time + Kind string + Limit int + To time.Time + type ActivitySnapshot struct + Day string + ID string + Metrics map[string]int64 + Revision int64 + Source string + Target Target + Visible bool + type Config struct + HeatWeights [4]float64 + HeatWindow time.Duration + MinimumHeatSamples int + Now func() time.Time + QueryTimeout time.Duration + type Document struct + Aliases []string + At time.Time + Code string + CourseID string + Revision int64 + SchoolID string + Target Target + TeacherIDs []string + Title string + Visible bool + type Event struct + Data Document + ID string + Source string + SpecVersion string + Subject string + Time time.Time + Type string + type Filter struct + After string + Kind string + Limit int + Query string + type Item struct + SchoolID string + Target Target + Title string + type Page struct + Items []Item + NextCursor string + type Repository interface + Activities func(context.Context, ActivityFilter) ([]ActivitySnapshot, error) + Apply func(context.Context, Event, string) error + ApplyActivity func(context.Context, ActivityEvent, string) error + Candidates func(context.Context, Filter) ([]Document, error) + Rebuild func(context.Context, ...) error + type Service struct + func New(repo Repository, sources Sources, c Config) (*Service, error) + func (s *Service) Consume(ctx context.Context, e Event) error + func (s *Service) ConsumeActivity(ctx context.Context, e ActivityEvent) error + func (s *Service) MyVotes(ctx context.Context, user, cursor string, limit int) (Votes, error) + func (s *Service) Popular(ctx context.Context, user, kind, cursor string, limit int) (Page, error) + func (s *Service) Rebuild(ctx context.Context) error + func (s *Service) Search(ctx context.Context, user, q, kind, cursor string, limit int) (Page, error) + type Sources interface + ActivitySnapshot func(context.Context, string, time.Time, time.Time, string, int) ([]ActivitySnapshot, string, error) + Current func(context.Context, string, Target) (Document, bool, error) + CurrentActivity func(context.Context, string, string, string) (ActivitySnapshot, bool, error) + DiscoverySnapshot func(context.Context, string, string, int) ([]Document, string, error) + MyVotes func(context.Context, string, string, int) (Votes, error) + type Target struct + ID string + Kind string + Source string + type Vote struct + Choice string + Target Target + type Votes struct + Items []Vote + NextCursor string