store

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package store provides file-backed persistence for quest todos.

Todos are stored as JSON in ~/.quest/todos.json. The package exposes helpers to load, save, look up by ID, and remove the store file.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("todo not found")

ErrNotFound is returned when a requested todo cannot be found.

Functions

func Nuke

func Nuke() error

Nuke removes the todo store file.

func Save

func Save(todos []Todo) error

Save writes todos to disk as indented JSON.

Types

type Todo

type Todo struct {
	ID        string     `json:"id"`
	Title     string     `json:"title"`
	Done      bool       `json:"done"`
	Deleted   bool       `json:"deleted"`
	CreatedAt time.Time  `json:"created_at"`
	DueDate   *time.Time `json:"due_date,omitempty"`
	Project   string     `json:"project,omitempty"`
}

Todo is the persisted model for a single task in the quest store.

func Load

func Load() ([]Todo, error)

Load reads todos from disk, returning an empty slice when the store does not exist.

func LoadAndFindIndexByID

func LoadAndFindIndexByID(id string) ([]Todo, int, error)

LoadAndFindIndexByID loads todos and returns the matching todo index for id.

Jump to

Keyboard shortcuts

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