todo

package module
v0.0.0-...-d1d52b8 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: MIT Imports: 7 Imported by: 0

README

go-todo

A simple To Do list written in Go.

Originally this was written as a CLI application but I have extended it to also include a web API.

The primary focus is now the backend web API using chi at cli/web_server, the example CLI application can be found at cmd/cli

To utilise the the backend I've put together a simple frontend using Svelte.

Running

The full web application utilising the backend and frontend can be run using:

docker compose up -d

It is then accessed at http://localhost:8080

Ideas for improvements

  • Add the ability to have multiple task lists, such as one for work and one for personal.
  • Add documentation for the API using swagger.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StatusResponse

type StatusResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type Task

type Task struct {
	Id       TaskId `json:"id"`
	Name     string `json:"name" validate:"required"`
	Complete bool   `json:"complete"`
}

func (*Task) Validate

func (t *Task) Validate() error

type TaskId

type TaskId int64

type TaskList

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

func CreateTaskList

func CreateTaskList(storage TaskStorage) *TaskList

func (*TaskList) Add

func (t *TaskList) Add(name string) (TaskId, error)

func (*TaskList) Delete

func (t *TaskList) Delete(task *Task) error

func (*TaskList) GetAll

func (t *TaskList) GetAll() ([]Task, error)

func (*TaskList) GetOne

func (t *TaskList) GetOne(id TaskId) (Task, error)

func (*TaskList) GetOutstanding

func (t *TaskList) GetOutstanding() ([]Task, error)

func (*TaskList) ToggleStatus

func (t *TaskList) ToggleStatus(task *Task) error

type TaskServer

type TaskServer struct {
	http.Handler
	// contains filtered or unexported fields
}

func NewTaskServer

func NewTaskServer(taskList *TaskList) *TaskServer

type TaskStorage

type TaskStorage interface {
	Add(*Task) (TaskId, error)
	GetAll() ([]Task, error)
	GetTask(TaskId) (*Task, error)
	ToggleStatus(TaskId) error
	GetOutstanding() ([]Task, error)
	Delete(TaskId) error
}

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

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