Documentation ¶
Index ¶
- Constants
- Variables
- type Attributes
- type BoltStorage
- type ByCreatedDate
- type ByDueDate
- type ByPriority
- type NullTime
- type Storage
- type Tags
- type Todo
- type TodoList
- type TodoListFilter
- type TodoManager
- func (me *TodoManager) Add(todoStr string) (int, error)
- func (me *TodoManager) AddAttribute(todoID int, attr string) error
- func (me *TodoManager) AddContext(todoID int, context string) error
- func (me *TodoManager) AddProject(todoID int, project string) error
- func (me *TodoManager) Append(todoID int, appendStr string) error
- func (me *TodoManager) Complete(todoID int) error
- func (me *TodoManager) Delete(todoID int) error
- func (me *TodoManager) Deprioritize(todoID int) error
- func (me *TodoManager) List(listFilter TodoListFilter) (TodoList, error)
- func (me *TodoManager) ListAttributes() ([]string, error)
- func (me *TodoManager) ListContexts() ([]string, error)
- func (me *TodoManager) ListProjects() ([]string, error)
- func (me *TodoManager) Prepend(todoID int, prependStr string) error
- func (me *TodoManager) Prioritize(todoID int, priorityString string) error
- func (me *TodoManager) Resume(todoID int) error
- func (me *TodoManager) Update(todoID int, todoStr string) error
Constants ¶
const ( ListPending = iota ListAll ListDone )
ListPending is all active todos ListAll is all todos, active and complete ListDone is all completed todos
const TimeFormat = "2006-01-02"
TimeFormat is the YYYY-MM-DD format used by todo.txt
Variables ¶
var InvalidTime = NullTime{Valid: false}
InvalidTime is a NullTime with Valid set to false and Time set to time.Time{}
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
Attributes is a key/value store for custom Todo metadata
type BoltStorage ¶
type BoltStorage struct{}
BoltStorage implements Storage, saving items to a file in the filesystem
func (*BoltStorage) Create ¶
func (me *BoltStorage) Create(todo *Todo) error
Create inserts a new *Todo
func (*BoltStorage) Delete ¶
func (me *BoltStorage) Delete(todoID int) error
Delete removes the *Todo identified by todoID
type ByCreatedDate ¶
type ByCreatedDate TodoList
ByCreatedDate provides sorting by Todo.CreationDate
func (ByCreatedDate) Less ¶
func (s ByCreatedDate) Less(i, j int) bool
Less compares two elements by CreationDate
func (ByCreatedDate) Swap ¶
func (s ByCreatedDate) Swap(i, j int)
Swap inverts positions of two elements
type ByDueDate ¶
type ByDueDate TodoList
ByDueDate provides sorting by Todo.DueDate
type ByPriority ¶
type ByPriority TodoList
ByPriority provides sorting by Todo.Priority
func (ByPriority) Less ¶
func (s ByPriority) Less(i, j int) bool
Less compares two elements by Priority
type NullTime ¶
NullTime combines time.Time with a flag to indicate its validity
func NewNullTime ¶
NewNullTime takes a timestamp and returns a NullTime
type Storage ¶
type Storage interface { Create(todo *Todo) error List() (TodoList, error) Get(todoID int) (*Todo, error) Update(todoID int, todo *Todo) error Delete(todoID int) error }
Storage provides an interface for various todo storage mechanisms (in-memory, filesystem)
type Todo ¶
type Todo struct { TodoID int Complete bool Priority int CompletionDate NullTime CreationDate NullTime DueDate NullTime Description string Projects Tags Contexts Tags CustomAttributes Attributes }
Todo contains information about a specific Todo
func FromString ¶
FromString translates a todotxt string into a *Todo
type TodoListFilter ¶
TodoListFilter provides filtering criteria for a TodoList
type TodoManager ¶
type TodoManager struct {
Storage Storage
}
TodoManager controls a TodoList
func (*TodoManager) Add ¶
func (me *TodoManager) Add(todoStr string) (int, error)
Add takes a todotxt string and adds it to the list of todos
func (*TodoManager) AddAttribute ¶
func (me *TodoManager) AddAttribute(todoID int, attr string) error
AddAttribute adds a context tag to a todo
func (*TodoManager) AddContext ¶
func (me *TodoManager) AddContext(todoID int, context string) error
AddContext adds a context tag to a todo
func (*TodoManager) AddProject ¶
func (me *TodoManager) AddProject(todoID int, project string) error
AddProject adds a project tag to a todo
func (*TodoManager) Append ¶
func (me *TodoManager) Append(todoID int, appendStr string) error
Append adds a string message to the end of a todo description
func (*TodoManager) Complete ¶
func (me *TodoManager) Complete(todoID int) error
Complete changes the completion status of a Todo to done and adds CompletionDate
func (*TodoManager) Delete ¶
func (me *TodoManager) Delete(todoID int) error
Delete drops the item specified by todoId from a TodoManager
func (*TodoManager) Deprioritize ¶
func (me *TodoManager) Deprioritize(todoID int) error
Deprioritize changes the priority of a Todo identified by todoID
func (*TodoManager) List ¶
func (me *TodoManager) List(listFilter TodoListFilter) (TodoList, error)
List returns a slice of Todos as determined by TodoListFilter criteria
func (*TodoManager) ListAttributes ¶
func (me *TodoManager) ListAttributes() ([]string, error)
ListAttributes returns a list of unique attribute keys
func (*TodoManager) ListContexts ¶
func (me *TodoManager) ListContexts() ([]string, error)
ListContexts returns a list of unique contexts
func (*TodoManager) ListProjects ¶
func (me *TodoManager) ListProjects() ([]string, error)
ListProjects returns a list of unique projects
func (*TodoManager) Prepend ¶
func (me *TodoManager) Prepend(todoID int, prependStr string) error
Prepend adds a string message to the front of a todo description
func (*TodoManager) Prioritize ¶
func (me *TodoManager) Prioritize(todoID int, priorityString string) error
Prioritize changes the priority of a Todo identified by todoID
func (*TodoManager) Resume ¶
func (me *TodoManager) Resume(todoID int) error
Resume changes the completion status of a todo and invalidates CompletionDate