models

package
v0.0.0-...-1710408 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	ID    int64  // Unique identifier
	Title string // Description
	Done  bool   // Is this task done?
}

func NewTask

func NewTask(title string) (*Task, error)

NewTask creates a new task given a title, that can't be empty.

type TaskManager

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

TaskManager manages a list of tasks in memory.

var DefaultTaskList *TaskManager

func NewTaskManager

func NewTaskManager() *TaskManager

NewTaskManager returns an empty TaskManager.

func (*TaskManager) All

func (m *TaskManager) All() []*Task

All returns the list of all the Tasks in the TaskManager.

func (*TaskManager) Find

func (m *TaskManager) Find(ID int64) (*Task, bool)

Find returns the Task with the given id in the TaskManager and a boolean indicating if the id was found.

func (*TaskManager) Save

func (m *TaskManager) Save(task *Task) error

Save saves the given Task in the TaskManager.

Jump to

Keyboard shortcuts

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