db

package
v0.0.0-...-8deacee Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Btodo = []byte("todo") // where all the new tasks go
	Bdone = []byte("done") // where all completed tasks go
)

Functions

func AddTask

func AddTask(name string) (key uint64, err error)

AddTask creates a new unique id and inserts the task into database

func CompleteTask

func CompleteTask(t Task) (err error)

func DeleteTask

func DeleteTask(key uint64) (err error)

DeleteTask removes a task from database using given key

func Init

func Init(path string) error

Init initializes the database and creates a bucket to store tasks

Types

type Task

type Task struct {
	Key uint64
	Val string
}

Task is a Go representation of key, value data for given todo

func ReadTasks

func ReadTasks(buc []byte) (tasks []Task, err error)

ReadTasks reads all the tasks from database and generated Go representation for the same

Jump to

Keyboard shortcuts

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