Versions in this module Expand all Collapse all v0 v0.55.2 Apr 12, 2025 v0.55.1 Apr 12, 2025 Changes in this version + func CalculateExponentialDecayTo(score, decayTo float64, halfLife time.Duration) time.Duration + func CalculateExponentialHalfLife(score, decayTo float64, duration time.Duration) time.Duration + type DecayFunc func(last, now time.Time, score float64) float64 + func ExponentialDecay(halfLife time.Duration, decayToZero float64) DecayFunc + func LinearDecay(decayPerSecond float64) DecayFunc + type Scoring struct + func New[T comparable](decayFunc DecayFunc, minScore, maxScore float64) *Scoring[T] + func (s *Scoring[T]) Add(id T, score float64) + func (s *Scoring[T]) AddAt(id T, score float64, at time.Time) + func (s *Scoring[T]) Decrease(id T, score float64) + func (s *Scoring[T]) DecreaseAt(id T, score float64, at time.Time) + func (s *Scoring[T]) Increase(id T, score float64) + func (s *Scoring[T]) IncreaseAt(id T, score float64, at time.Time) + func (s *Scoring[T]) Map() map[T]float64 + func (s *Scoring[T]) MapAt(at time.Time) map[T]float64 + func (s *Scoring[T]) Ranked(granularity float64) []T + func (s *Scoring[T]) RankedAt(at time.Time, granularity float64) []T + func (s *Scoring[T]) Remove(id T) + func (s *Scoring[T]) Score(id T) (float64, bool) + func (s *Scoring[T]) ScoreAt(id T, at time.Time) (float64, bool)