Documentation
¶
Overview ¶
Package notinterested stores viewer-specific title exclusions. It does not affect ranking or browsing until a caller explicitly applies the preference.
Index ¶
- Variables
- type Entry
- type Options
- type Service
- func (s *Service) Generation() uint64
- func (s *Service) Has(ctx context.Context, v *core.User, key core.RatingKey) (bool, error)
- func (s *Service) HasMany(ctx context.Context, v *core.User, keys []core.RatingKey) (map[core.RatingKey]bool, error)
- func (s *Service) List(ctx context.Context, v *core.User, limit int) ([]Entry, error)
- func (s *Service) ListUndo(ctx context.Context, v *core.User) ([]UndoEntry, error)
- func (s *Service) Set(ctx context.Context, v *core.User, key core.RatingKey, excluded bool) (bool, error)
- func (s *Service) Snapshot(ctx context.Context, v *core.User) ([]Entry, uint64, error)
- func (s *Service) Undo(ctx context.Context, v *core.User, handle string) (bool, error)
- type UndoEntry
Constants ¶
This section is empty.
Variables ¶
var ErrForbidden = errors.New("notinterested: viewer or title unavailable")
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
DB *sql.DB
Active func(context.Context, int64) (*core.User, error)
Allowed func(context.Context, *core.User, core.RatingKey) bool
Changed func(context.Context, int64, core.RatingKey)
Now func() time.Time
}
Options supplies the shared database and current authorization checks. Changed is called once after each successful change and never for a no-op.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Generation ¶
Generation changes when a title is hidden or restored.
func (*Service) HasMany ¶
func (s *Service) HasMany(ctx context.Context, v *core.User, keys []core.RatingKey) (map[core.RatingKey]bool, error)
HasMany reads membership for keys the caller already authorized. It checks the viewer once and issues one query per chunk.
func (*Service) List ¶
List filters before applying limit; hidden titles never appear in the undo UI. A nonpositive limit returns all permitted entries.
func (*Service) ListUndo ¶
ListUndo returns opaque handles for all saved exclusions; ordering by handle does not disclose when an inaccessible item was added.
func (*Service) Set ¶
func (s *Service) Set(ctx context.Context, v *core.User, key core.RatingKey, excluded bool) (bool, error)
Set records or undoes an exclusion. Both operations require current access, so knowledge of an old key cannot be used to probe an inaccessible title.