Documentation
¶
Index ¶
- Variables
- func FormatTimeUntil(d time.Duration) string
- type NotificationTier
- type Reminder
- type ReminderCallback
- type Scheduler
- type Store
- func (s *Store) Create(ctx context.Context, title, description string, remindAt time.Time) (*Reminder, error)
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) FindByTitle(ctx context.Context, title string) ([]*Reminder, error)
- func (s *Store) Get(ctx context.Context, id string) (*Reminder, error)
- func (s *Store) GetPendingReminders(ctx context.Context) ([]*Reminder, error)
- func (s *Store) List(ctx context.Context, includeCompleted bool) ([]*Reminder, error)
- func (s *Store) MarkCompleted(ctx context.Context, id string) error
- func (s *Store) MarkNotified(ctx context.Context, id string, tier string) error
- func (s *Store) Update(ctx context.Context, id string, title, description *string, ...) (*Reminder, error)
Constants ¶
This section is empty.
Variables ¶
var NotificationTiers = []NotificationTier{ {"24h", 24 * time.Hour, "notified_24h"}, {"12h", 12 * time.Hour, "notified_12h"}, {"3h", 3 * time.Hour, "notified_3h"}, {"1h", 1 * time.Hour, "notified_1h"}, {"10m", 10 * time.Minute, "notified_10m"}, {"at_time", 0, "notified_at_time"}, }
Standard notification tiers
Functions ¶
func FormatTimeUntil ¶
FormatTimeUntil formats the time until a reminder in a human-readable way
Types ¶
type NotificationTier ¶
NotificationTier represents a notification time before the reminder
type Reminder ¶
type Reminder struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
RemindAt time.Time `json:"remind_at"`
Notified24h bool `json:"notified_24h"`
Notified12h bool `json:"notified_12h"`
Notified3h bool `json:"notified_3h"`
Notified1h bool `json:"notified_1h"`
Notified10m bool `json:"notified_10m"`
NotifiedAtTime bool `json:"notified_at_time"`
Completed bool `json:"completed"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Reminder represents a reminder in the system
type ReminderCallback ¶
ReminderCallback is called when a reminder notification should be sent
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler checks for upcoming reminders and triggers notifications
func NewScheduler ¶
NewScheduler creates a new reminder scheduler
func (*Scheduler) SetCallback ¶
func (s *Scheduler) SetCallback(cb ReminderCallback)
SetCallback sets the notification callback
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles reminder persistence
func (*Store) Create ¶
func (s *Store) Create(ctx context.Context, title, description string, remindAt time.Time) (*Reminder, error)
Create creates a new reminder
func (*Store) FindByTitle ¶
FindByTitle finds reminders matching a title (case-insensitive partial match)
func (*Store) GetPendingReminders ¶
GetPendingReminders returns reminders that need notification checks
func (*Store) MarkCompleted ¶
MarkCompleted marks a reminder as completed
func (*Store) MarkNotified ¶
MarkNotified marks a specific notification tier as sent