core

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package core provides shared reminder types and storage operations used by all remind subcommand packages. Subcommands import core, never each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextID

func NextID(reminders []Reminder) int

NextID returns the next available reminder ID (max existing + 1).

Parameters:

  • reminders: Existing reminders to scan

Returns:

  • int: The next sequential ID

func RemindersPath

func RemindersPath() string

RemindersPath returns the full path to the reminders JSON file.

Returns:

  • string: Absolute path to reminders.json

func WriteReminders

func WriteReminders(reminders []Reminder) error

WriteReminders writes all reminders to the JSON file.

Parameters:

  • reminders: The reminder slice to persist

Returns:

  • error: Non-nil on marshal or write failure

Types

type Reminder

type Reminder struct {
	ID      int     `json:"id"`
	Message string  `json:"message"`
	Created string  `json:"created"`
	After   *string `json:"after"` // nullable YYYY-MM-DD
}

Reminder represents a single session-scoped reminder.

func ReadReminders

func ReadReminders() ([]Reminder, error)

ReadReminders reads all reminders from the JSON file.

Returns:

  • []Reminder: The parsed reminders (nil when file absent)
  • error: Non-nil on read or parse failure

Jump to

Keyboard shortcuts

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