store

package
v0.0.0-...-76a21d3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	DB *bolt.DB
}

Store represents a task store with various high level helper methods

func NewStore

func NewStore() (*Store, error)

NewStore creates and bootstraps a new task store

func (*Store) Close

func (s *Store) Close()

Close closes the database backing the store

func (*Store) CompleteTask

func (s *Store) CompleteTask(id int) (Task, error)

CompleteTask marks a task as done given it's ID

func (*Store) DeleteAllTasks

func (s *Store) DeleteAllTasks() error

DeleteAllTasks deletes all tasks by deleting thw whole bucket

func (*Store) DeleteTask

func (s *Store) DeleteTask(id int) (Task, error)

DeleteTask deletes a specific task given it's ID

func (*Store) GetActiveTasks

func (s *Store) GetActiveTasks() ([]Task, error)

GetActiveTasks return list of currently active tasks

func (*Store) GetAllCompletedTasks

func (s *Store) GetAllCompletedTasks() ([]Task, error)

GetAllCompletedTasks return list of completed tasks

func (*Store) GetAllTasks

func (s *Store) GetAllTasks() ([]Task, error)

GetAllTasks returns all tasks (both active and done)

func (*Store) GetTasksDoneToday

func (s *Store) GetTasksDoneToday() ([]Task, error)

GetTasksDoneToday returns task which are marked as done today

func (*Store) InsertTask

func (s *Store) InsertTask(data string) error

InsertTask inserts a new task into DB

type Task

type Task struct {
	ID        int
	Value     string
	Done      bool
	TimeStamp string
}

Task represents a single task

Jump to

Keyboard shortcuts

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