Documentation ¶
Index ¶
- Variables
- func MockLoadSave(t *testing.T, dayList *DayList)
- type Day
- func (d *Day) AddNewPause(s time.Time, txt string) error
- func (d *Day) AddNewTask(s time.Time, txt string, tgs []string) error
- func (d *Day) AddTask(task *Task)
- func (d *Day) End() time.Time
- func (d *Day) Finish(f time.Time) error
- func (d *Day) IsEmpty() bool
- func (d *Day) IsFinished() bool
- func (d *Day) IsToday() bool
- func (d *Day) OvertimeDuration() (time.Duration, bool)
- func (d *Day) Pred(task Task) (*Task, error)
- func (d *Day) RemoveTask(timeToDelete time.Time) bool
- func (d *Day) Start() time.Time
- func (d *Day) Succ(task Task) (*Task, error)
- func (d *Day) Tags() []string
- func (d *Day) TaskDuration(task Task) time.Duration
- func (d *Day) TotalBreakDuration() time.Duration
- func (d *Day) TotalDuration() time.Duration
- func (d *Day) TotalTagDuration(tag string) time.Duration
- func (d *Day) TotalWorkDuration() time.Duration
- func (d *Day) Unfinished()
- type DayList
- type Task
- type Week
Constants ¶
This section is empty.
Variables ¶
var ( NoTask = errors.New("no task") NoTaskSucc = errors.New("no succeeding task") NoTaskPred = errors.New("no preceding task") )
var Load = loadFunc
var Save = saveFunc
Functions ¶
func MockLoadSave ¶
MockLoadSave is a function that mocks the behavior of the data.Load and data.Save functions by replacing them with custom implementations. The original functions are stored and can be restored later by calling the returned function.
The mocked data.Load function always returns the provided dayList and nil error. The mocked data.Save function always returns nil error.
Should not be called from production code!
Types ¶
type Day ¶
func (*Day) IsFinished ¶
func (*Day) RemoveTask ¶
RemoveTask removes a task from the Day's list of tasks based on the specified time. It returns true if a task was found and removed, otherwise false.
func (*Day) TotalBreakDuration ¶
func (*Day) TotalDuration ¶
func (*Day) TotalWorkDuration ¶
func (*Day) Unfinished ¶
func (d *Day) Unfinished()
type DayList ¶
type DayList struct {
Days []*Day
}
func (*DayList) Day ¶
Day returns the Day struct for the specified date.
The returned struct is a copy of the day. Changes to this day won't be applied to the data model automatically.