tracker

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const FileName = "gotrack.json"

Variables

View Source
var (
	ErrEntryAlreadyExists = fmt.Errorf("entry with this title already exists")
	ErrActivityNotFound   = fmt.Errorf("there is no activity with given id")
)

Functions

This section is empty.

Types

type Activity

type Activity struct {
	ID      int      `json:"id"`
	Title   string   `json:"title"`
	Tags    []string `json:"tags"`
	Context []string `json:"context"`
	Spans   []*Span  `json:"spans"`
}

func (*Activity) Duration

func (a *Activity) Duration() time.Duration

func (*Activity) LastDuration

func (a *Activity) LastDuration() time.Duration

func (*Activity) Started

func (a *Activity) Started() *Span

type Document

type Document struct {
	LastKey    int         `json:"last"`
	Activities []*Activity `json:"activities"`
}

type Span

type Span struct {
	Start   time.Time  `json:"start"`
	Stop    *time.Time `json:"stop,omitempty"`
	Comment string     `json:"comment,omitempty"`
}

type Timespan

type Timespan time.Duration

func (Timespan) Format

func (t Timespan) Format() string

type Tracker

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

func New

func New(fs afero.Fs) (*Tracker, error)

func (*Tracker) Activity

func (t *Tracker) Activity(id int) *Activity

func (*Tracker) Add

func (t *Tracker) Add(title string, tags []string, contexts []string) (int, error)

func (*Tracker) List

func (t *Tracker) List(all bool) []*Activity

func (*Tracker) Start

func (t *Tracker) Start(id int, comment string) error

func (*Tracker) Stop

func (t *Tracker) Stop(id int) error

Jump to

Keyboard shortcuts

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