pomodoro

package
v0.0.0-...-1c04265 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 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

This section is empty.

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 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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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