reminder

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package reminder encapsulates reminder state transitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	State StateTracker
}

Handler manages reminder state transitions.

func NewHandler

func NewHandler(s StateTracker) *Handler

NewHandler creates a new reminder handler.

func (*Handler) Ack

func (h *Handler) Ack(name string) (acknowledged bool, err error)

Ack marks a reminder as acknowledged, clearing overdue count and snooze. Returns false if the reminder is not in a pending or snoozed state.

func (*Handler) Fire

func (h *Handler) Fire(name string) error

Fire records that a reminder has been triggered. If the reminder is already pending or snoozed, the overdue count is incremented (stacking). Otherwise it transitions to pending with overdue count 1.

func (*Handler) Snooze

func (h *Handler) Snooze(name string, until time.Time) error

Snooze marks a reminder as snoozed until the given time. Returns an error if the reminder is not in a pending or snoozed state.

type InvalidStateError

type InvalidStateError struct {
	Name  string
	State state.ReminderStatus
}

InvalidStateError is returned when a state transition is not valid.

func (*InvalidStateError) Error

func (e *InvalidStateError) Error() string

type StateTracker

type StateTracker interface {
	GetReminderState(name string) state.ReminderState
	SetReminderState(name string, rs state.ReminderState)
	Save() error
}

StateTracker defines the interface for state operations needed by Handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL