todolist

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION = "0.6.1"
	S3URL   = "https://s3.amazonaws.com/todolist-local/" + VERSION
)
View Source
const ISO8601_TIMESTAMP_FORMAT = "2006-01-02T15:04:05Z07:00"

Timestamp format to include date, time with timezone support. Easy to parse

Variables

This section is empty.

Functions

func AddIfNotThere

func AddIfNotThere(arr []string, items []string) []string

func GetTodos

func GetTodos(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func IndexScaffold

func IndexScaffold(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func RedirectScaffold

func RedirectScaffold(w http.ResponseWriter, r *http.Request)

func RedirectToIndex

func RedirectToIndex(w http.ResponseWriter, r *http.Request)

func SaveTodos

func SaveTodos(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func TodoOptions

func TodoOptions(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

Types

type App

type App struct {
	TodoStore Store
	Printer   Printer
	TodoList  *TodoList
}

func NewApp

func NewApp() *App

func (*App) AddDoneTodo

func (a *App) AddDoneTodo(input string)

AddDoneTodo Adds a todo and immediately completed it.

func (*App) AddTodo

func (a *App) AddTodo(input string)

func (*App) ArchiveCompleted

func (a *App) ArchiveCompleted()

func (*App) ArchiveTodo

func (a *App) ArchiveTodo(input string)

func (*App) CompleteTodo

func (a *App) CompleteTodo(input string)

func (*App) DeleteTodo

func (a *App) DeleteTodo(input string)

func (*App) EditTodo

func (a *App) EditTodo(input string)

func (*App) ExpandTodo

func (a *App) ExpandTodo(input string)

func (*App) GarbageCollect

func (a *App) GarbageCollect()

func (*App) HandleNotes

func (a *App) HandleNotes(input string)

func (*App) InitializeRepo

func (a *App) InitializeRepo()

func (*App) ListTodos

func (a *App) ListTodos(input string)

func (*App) Load

func (a *App) Load() error

func (*App) PrioritizeTodo

func (a *App) PrioritizeTodo(input string)

func (*App) Save

func (a *App) Save()

func (*App) UnarchiveTodo

func (a *App) UnarchiveTodo(input string)

func (*App) UncompleteTodo

func (a *App) UncompleteTodo(input string)

func (*App) UnprioritizeTodo

func (a *App) UnprioritizeTodo(input string)

type ByDate

type ByDate []*Todo

func (ByDate) Len

func (a ByDate) Len() int

func (ByDate) Less

func (a ByDate) Less(i, j int) bool

func (ByDate) Swap

func (a ByDate) Swap(i, j int)

type DateFilter

type DateFilter struct {
	Todos    []*Todo
	Location *time.Location
}

func NewDateFilter

func NewDateFilter(todos []*Todo) *DateFilter

func (*DateFilter) FilterDate

func (f *DateFilter) FilterDate(input string) []*Todo

func (*DateFilter) FindSunday

func (f *DateFilter) FindSunday(pivot time.Time) time.Time

type FileStore

type FileStore struct {
	FileLocation string
	Loaded       bool
}

func NewFileStore

func NewFileStore() *FileStore

func (*FileStore) Initialize

func (f *FileStore) Initialize()

func (*FileStore) Load

func (f *FileStore) Load() ([]*Todo, error)

func (*FileStore) Save

func (f *FileStore) Save(todos []*Todo)

type GroupedTodos

type GroupedTodos struct {
	Groups map[string][]*Todo
}

type Grouper

type Grouper struct{}

func (*Grouper) GroupByContext

func (g *Grouper) GroupByContext(todos []*Todo) *GroupedTodos

func (*Grouper) GroupByNothing

func (g *Grouper) GroupByNothing(todos []*Todo) *GroupedTodos

func (*Grouper) GroupByProject

func (g *Grouper) GroupByProject(todos []*Todo) *GroupedTodos

type MemoryPrinter

type MemoryPrinter struct {
	Groups *GroupedTodos
}

func (*MemoryPrinter) Print

func (m *MemoryPrinter) Print(groupedTodos *GroupedTodos, printNotes bool)

type MemoryStore

type MemoryStore struct {
	Todos []*Todo
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Initialize

func (m *MemoryStore) Initialize()

func (*MemoryStore) Load

func (m *MemoryStore) Load() ([]*Todo, error)

func (*MemoryStore) Save

func (m *MemoryStore) Save(todos []*Todo)

type Parser

type Parser struct{}

func (*Parser) Contexts

func (p *Parser) Contexts(input string) []string

func (*Parser) Due

func (p *Parser) Due(input string, day time.Time) string

func (*Parser) ExpandProject

func (p *Parser) ExpandProject(input string) string

func (*Parser) ParseAddNote

func (p *Parser) ParseAddNote(todo *Todo, input string) bool

func (*Parser) ParseDeleteNote

func (p *Parser) ParseDeleteNote(todo *Todo, input string) bool

func (*Parser) ParseEditNote

func (p *Parser) ParseEditNote(todo *Todo, input string) bool

func (*Parser) ParseEditTodo

func (p *Parser) ParseEditTodo(todo *Todo, input string) bool

func (*Parser) ParseNewTodo

func (p *Parser) ParseNewTodo(input string) *Todo

func (*Parser) ParseShowNote

func (p *Parser) ParseShowNote(todo *Todo, input string) bool

func (*Parser) Projects

func (p *Parser) Projects(input string) []string

func (*Parser) Subject

func (p *Parser) Subject(input string) string

type Printer

type Printer interface {
	Print(*GroupedTodos, bool)
}

type ScreenPrinter

type ScreenPrinter struct {
	Writer *tabwriter.Writer
}

func NewScreenPrinter

func NewScreenPrinter() *ScreenPrinter

func (*ScreenPrinter) Print

func (f *ScreenPrinter) Print(groupedTodos *GroupedTodos, printNotes bool)

type Store

type Store interface {
	Initialize()
	Load() ([]*Todo, error)
	Save(todos []*Todo)
}

type Todo

type Todo struct {
	Id            int      `json:"id"`
	Subject       string   `json:"subject"`
	Projects      []string `json:"projects"`
	Contexts      []string `json:"contexts"`
	Due           string   `json:"due"`
	Completed     bool     `json:"completed"`
	CompletedDate string   `json:"completedDate"`
	Archived      bool     `json:"archived"`
	IsPriority    bool     `json:"isPriority"`
	Notes         []string `json:"notes"`
}

func AddTodoIfNotThere

func AddTodoIfNotThere(arr []*Todo, item *Todo) []*Todo

func NewTodo

func NewTodo() *Todo

func (*Todo) Archive

func (t *Todo) Archive()

func (Todo) CalculateDueTime

func (t Todo) CalculateDueTime() time.Time

func (*Todo) Complete

func (t *Todo) Complete()

func (Todo) CompletedDateToDate

func (t Todo) CompletedDateToDate() string

func (*Todo) Prioritize

func (t *Todo) Prioritize()

func (*Todo) Unarchive

func (t *Todo) Unarchive()

func (*Todo) Uncomplete

func (t *Todo) Uncomplete()

func (*Todo) Unprioritize

func (t *Todo) Unprioritize()

func (Todo) Valid

func (t Todo) Valid() bool

type TodoFilter

type TodoFilter struct {
	Todos []*Todo
}

func NewFilter

func NewFilter(todos []*Todo) *TodoFilter

func (*TodoFilter) Filter

func (f *TodoFilter) Filter(input string) []*Todo

type TodoList

type TodoList struct {
	Data []*Todo
}

func (*TodoList) Add

func (t *TodoList) Add(todo *Todo)

func (*TodoList) Archive

func (t *TodoList) Archive(ids ...int)

func (*TodoList) Complete

func (t *TodoList) Complete(ids ...int)

func (*TodoList) Delete

func (t *TodoList) Delete(ids ...int)

func (*TodoList) FindById

func (t *TodoList) FindById(id int) *Todo

func (*TodoList) GarbageCollect

func (t *TodoList) GarbageCollect()

func (*TodoList) IndexOf

func (t *TodoList) IndexOf(todoToFind *Todo) int

func (*TodoList) Load

func (t *TodoList) Load(todos []*Todo)

func (*TodoList) MaxId

func (t *TodoList) MaxId() int

func (*TodoList) NextId

func (t *TodoList) NextId() int

func (*TodoList) Prioritize

func (t *TodoList) Prioritize(ids ...int)

func (*TodoList) Todos

func (t *TodoList) Todos() []*Todo

func (*TodoList) Unarchive

func (t *TodoList) Unarchive(ids ...int)

func (*TodoList) Uncomplete

func (t *TodoList) Uncomplete(ids ...int)

func (*TodoList) Unprioritize

func (t *TodoList) Unprioritize(ids ...int)

type Webapp

type Webapp struct {
	Router *httprouter.Router
}

func NewWebapp

func NewWebapp() *Webapp

func (*Webapp) Run

func (w *Webapp) Run()

Jump to

Keyboard shortcuts

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