todolist

package
v0.0.0-...-e36c0f0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("list not found")
	ErrItemNotFound = errors.New("item not found")
)

Generic error messages

Functions

This section is empty.

Types

type Core

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

Core ...

func NewCore

func NewCore(db *sql.DB) *Core

NewCore implements Todo List Management Core Logic

func (*Core) AddTodoItem

func (c *Core) AddTodoItem(lid int64, item *TodoItem) (*TodoItem, error)

AddTodoItem adds item to the list

func (*Core) AddTodoList

func (c *Core) AddTodoList(list *TodoList) (*TodoList, error)

AddTodoList creates a todo list with it's items

func (*Core) DeleteTodoList

func (c *Core) DeleteTodoList(id int64) error

DeleteTodoList removes a todo list with it's items

func (*Core) DeleteTodoListItem

func (c *Core) DeleteTodoListItem(id int64) error

DeleteTodoListItem removes items from the list

func (*Core) EditTodoListName

func (c *Core) EditTodoListName(id int64, name string) error

EditTodoListName updates the name of the list

func (*Core) Ex

func (c *Core) Ex(name string) error

Ex create user

func (*Core) GetTodoList

func (c *Core) GetTodoList(id int64) (*TodoList, error)

GetTodoList returns whole todolist

func (*Core) GetTodoListItem

func (c *Core) GetTodoListItem(id int64) (*TodoItem, error)

GetTodoListItem returns a todolist item

func (*Core) UpdateTodoItem

func (c *Core) UpdateTodoItem(item *TodoItem) error

UpdateTodoItem updates an item

type TodoItem

type TodoItem struct {
	ID        int64  `json:"id"`
	Value     string `json:"value"`
	Completed bool   `json:"completed"`
}

TodoItem ...

type TodoList

type TodoList struct {
	ID    int64       `json:"id"`
	Items []*TodoItem `json:"items"`
	Name  string      `json:"name"`
}

TodoList ...

Jump to

Keyboard shortcuts

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