pomodoro

package
v0.0.0-...-2067a7d Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryPomodoro   = "Pomodoro"
	CategoryShortBreak = "ShortBreak"
	CategoryLongBreak  = "LongBreak"
)

Category constants

View Source
const (
	StateNotStarted = iota
	StateRunning
	StatePaused
	StateDone
	StateCancelled
)

State constants

Variables

View Source
var (
	ErrNoIntervals        = errors.New("No intervals")
	ErrIntervalNotRunning = errors.New("Interval not running")
	ErrIntervalCompleted  = errors.New("Interval is completed or cancelled")
	ErrInvalidState       = errors.New("Invalid State")
	ErrInvalidID          = errors.New("Invalid ID")
)

Functions

func DailySummary

func DailySummary(day time.Time,
	config *IntervalConfig) ([]time.Duration, error)

Types

type Callback

type Callback func(Interval)

type Interval

type Interval struct {
	ID              int64
	StartTime       time.Time
	PlannedDuration time.Duration
	ActualDuration  time.Duration
	Category        string
	State           int
}

func GetInterval

func GetInterval(config *IntervalConfig) (Interval, error)

func (Interval) Pause

func (i Interval) Pause(config *IntervalConfig) error

func (Interval) Start

func (i Interval) Start(ctx context.Context, config *IntervalConfig,
	start, periodic, end Callback) error

type IntervalConfig

type IntervalConfig struct {
	PomodoroDuration   time.Duration
	ShortBreakDuration time.Duration
	LongBreakDuration  time.Duration
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(repo Repository, pomodoro, shortBreak,
	longBreak time.Duration) *IntervalConfig

type LineSeries

type LineSeries struct {
	Name   string
	Labels map[int]string
	Values []float64
}

func RangeSummary

func RangeSummary(start time.Time, n int,
	config *IntervalConfig) ([]LineSeries, error)

type Repository

type Repository interface {
	Create(i Interval) (int64, error)
	Update(i Interval) error
	ByID(id int64) (Interval, error)
	Last() (Interval, error)
	Breaks(n int) ([]Interval, error)
	CategorySummary(day time.Time, filter string) (time.Duration, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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