todo

package
v0.0.0-...-dd4288c Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheFilePath = getCacheFilePath()

Functions

func InitCache

func InitCache() error

func InitTodosFile

func InitTodosFile() error

InitTodosFile creates the JSON which stores the todos if it does not exist and initialize it with an empty array.

func ParseStatus

func ParseStatus(s string) (status, error)

func SaveTodos

func SaveTodos(todos []*Todo) error

Save a slice of todo in the file. Overwrites all the todos already present in the file.

func SetVar

func SetVar(key, value string) error

Types

type Todo

type Todo struct {
	ID          uuid.UUID `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Status      status    `json:"status"`
}

func NewTodo

func NewTodo(title, description string) Todo

func NewTodoWithID

func NewTodoWithID(id uuid.UUID, title, description string) Todo

func ReadTodosFile

func ReadTodosFile() ([]Todo, error)

func (*Todo) SetDescription

func (t *Todo) SetDescription(newDescription string)

func (*Todo) SetStatus

func (t *Todo) SetStatus(newStatus status)

func (*Todo) SetTitle

func (t *Todo) SetTitle(newTitle string)

func (Todo) String

func (t Todo) String() string

type TodoList

type TodoList struct {
	Todos []*Todo
}

func NewTodoList

func NewTodoList() (*TodoList, error)

func (*TodoList) AddTodo

func (tl *TodoList) AddTodo(t Todo)

func (*TodoList) Display

func (tl *TodoList) Display()

func (*TodoList) FindTodo

func (tl *TodoList) FindTodo(id uuid.UUID) (*Todo, error)

func (*TodoList) RemoveTodo

func (tl *TodoList) RemoveTodo(id uuid.UUID) (string, error)

func (*TodoList) UpdateTodoDescription

func (tl *TodoList) UpdateTodoDescription(id uuid.UUID, newDescription string) error

func (*TodoList) UpdateTodoStatus

func (tl *TodoList) UpdateTodoStatus(id uuid.UUID, newStatus status) error

func (*TodoList) UpdateTodoTitle

func (tl *TodoList) UpdateTodoTitle(id uuid.UUID, newTitle string) error

type Vars

type Vars struct {
	SelectedTodoID string `yaml:"selectedTodoID"`
}

Cached variables.

func LoadCache

func LoadCache() (Vars, error)

Jump to

Keyboard shortcuts

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