Documentation ¶
Overview ¶
Package db provides functions and data structures for manipulating local go boltdb database in terms of creating and editing tasks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteTask ¶
DeleteTask removes task with given id from task bucket.
Types ¶
type Checker ¶
Checker chceks for specific informations about single task.
func TagChecker ¶
TagChecker returns Checker which checks if Task contains given tag.
type Task ¶
type Task struct { ID int `json:"id"` Body string `json:"body"` Tags []string `json:"tags"` Date time.Time `json:"date"` }
Task represents single taks.
func GetAllTasks ¶
GetAllTasks returns slice containing all Tasks from taskBucket.
func GetTask ¶
GetTask returns task in form of Task struct from taskBucket under the key equal to given id.
func TaskFromJSON ¶
TaskFromJSON returns Task parsed from given bytes slice containg JSON.
func TaskSelection ¶
TaskSelection applies given Checker funcs to slice of tasks and returns Task slice, which fullfils Checkers requirements.
func TasksFromJSON ¶
TasksFromJSON returns Task slice parsed from given bytes slice containg json.
func (*Task) ParseTags ¶
ParseTags creates a list of strings (tags) from tags in string separated with given character.
func (*Task) ReadFromJSON ¶
ReadFromJSON updates fields of Task with data from given []byte slice.
func (*Task) SetCurrDate ¶
func (t *Task) SetCurrDate()
SetCurrDate updates Task time to current one.