todolist

package
v0.0.0-...-024696b Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION = "0.6"
	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
	TodoList  *TodoList
}

func NewApp

func NewApp() *App

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) 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 Formatter

type Formatter struct {
	GroupedTodos *GroupedTodos
	Writer       *tabwriter.Writer
}

func NewFormatter

func NewFormatter(todos *GroupedTodos) *Formatter

func (*Formatter) Print

func (f *Formatter) Print()

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 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) ParseEditTodo

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

func (*Parser) ParseNewTodo

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

func (*Parser) Projects

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

func (*Parser) Subject

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

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"`
}

func AddTodoIfNotThere

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

func NewTodo

func NewTodo() *Todo

func (Todo) CalculateDueTime

func (t Todo) CalculateDueTime() time.Time

func (*Todo) Complete

func (t *Todo) Complete()

func (*Todo) Uncomplete

func (t *Todo) Uncomplete()

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(id int)

func (*TodoList) Complete

func (t *TodoList) Complete(id int)

func (*TodoList) Delete

func (t *TodoList) Delete(id 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(id int)

func (*TodoList) Todos

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

func (*TodoList) Unarchive

func (t *TodoList) Unarchive(id int)

func (*TodoList) Uncomplete

func (t *TodoList) Uncomplete(id int)

func (*TodoList) Unprioritize

func (t *TodoList) Unprioritize(id 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