store

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package store provides task persistence and retrieval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

type FileStore struct {
	// contains filtered or unexported fields
}

FileStore implements Store using a JSON file for persistence.

func NewFileStore

func NewFileStore(path string) (*FileStore, error)

NewFileStore creates a new file-based store.

func (*FileStore) Close

func (fs *FileStore) Close() error

Close stops the background saver and performs final save. Safe to call multiple times.

func (*FileStore) Delete

func (fs *FileStore) Delete(id string) error

Delete removes a task by ID.

func (*FileStore) ForceSave

func (fs *FileStore) ForceSave() error

ForceSave immediately persists all tasks to disk.

func (*FileStore) Get

func (fs *FileStore) Get(id string) (*models.Task, error)

Get retrieves a task by ID.

func (*FileStore) List

func (fs *FileStore) List(filter ListFilter) ([]*models.Task, error)

List retrieves tasks matching the filter.

func (*FileStore) Reload

func (fs *FileStore) Reload() error

Reload reloads the store from disk.

func (*FileStore) Save

func (fs *FileStore) Save(task *models.Task) error

Save stores or updates a task.

func (*FileStore) UpdateStatus

func (fs *FileStore) UpdateStatus(id string, status models.TaskStatus) error

UpdateStatus updates only the status of a task.

type ListFilter

type ListFilter struct {
	Status []models.TaskStatus
	Tags   []string
	Limit  int
	Offset int
}

ListFilter defines criteria for listing tasks.

type Store

type Store interface {
	Save(task *models.Task) error
	Get(id string) (*models.Task, error)
	List(filter ListFilter) ([]*models.Task, error)
	Delete(id string) error
	UpdateStatus(id string, status models.TaskStatus) error
	Close() error
}

Store defines the interface for task storage.

Jump to

Keyboard shortcuts

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