Documentation
¶
Index ¶
- func GoalForRange(goal Goal, startDate, endDate Date) time.Duration
- func ToString(w time.Weekday) string
- type Backlog
- func (b *Backlog) AddAfter(anchorTask *Task) (newTask *Task, parent *Task, err error)
- func (b *Backlog) AddBefore(anchorTask *Task) (newTask *Task, parent *Task, err error)
- func (b *Backlog) AddLast() *Task
- func (b *Backlog) Locate(task *Task) (prev *Task, next *Task, parentage []*Task, index int, err error)
- func (b *Backlog) Pop(task *Task) (prev *Task, next *Task, parentage []*Task, err error)
- func (b *Backlog) Write(w io.Writer) error
- type BacklogStored
- type BaseTask
- type ByName
- type ByStartConsideringDuration
- type Category
- type Date
- func (d Date) Backward(by int) Date
- func (a Date) DaysUntil(b Date) int
- func (d Date) Forward(by int) Date
- func (d Date) GetDayInMonth(index int) Date
- func (d Date) GetDayInWeek(index int) Date
- func (d Date) GetLastOfMonth() Date
- func (d Date) GetSunTimes(latitude, longitude float64) SunTimes
- func (d Date) Is(t time.Time) bool
- func (a Date) IsAfter(b Date) bool
- func (a Date) IsBefore(b Date) bool
- func (d Date) MonthBounds() (first Date, last Date)
- func (d Date) Next() Date
- func (d Date) Prev() Date
- func (d Date) ToGotime() time.Time
- func (d Date) ToString() string
- func (d Date) ToWeekday() time.Weekday
- func (d Date) Valid() bool
- func (d Date) Week() (monday Date, sunday Date)
- type Day
- func (day *Day) AddEvent(e *Event) error
- func (day *Day) Clone() *Day
- func (day *Day) CurrentNext()
- func (day *Day) CurrentPrev()
- func (day *Day) Flatten()
- func (day *Day) GetEventsFrom(event *Event) []*Event
- func (day *Day) GetNextEventAfter(t Timestamp) *Event
- func (day *Day) GetPrevEventBefore(t Timestamp) *Event
- func (day *Day) GetTimesheetEntry(matcher func(string) bool) TimesheetEntry
- func (day *Day) MoveEventsPushingBy(event *Event, duration int, snapMinsMod int) error
- func (day *Day) MoveSingleEventBy(event *Event, duration int, snapMinsMod int) error
- func (day *Day) MoveSingleEventTo(event *Event, newStart Timestamp) error
- func (day *Day) RemoveEvent(event *Event)
- func (day *Day) ResizeBy(event *Event, delta int) error
- func (day *Day) ResizeTo(event *Event, newEnd Timestamp) error
- func (day *Day) SnapEnd(event *Event, resolution int) error
- func (day *Day) SplitEvent(originalEvent *Event, timestamp Timestamp) error
- func (day *Day) SumUpByCategory() map[Category]int
- func (day *Day) ToSlice() []string
- func (day *Day) UpdateEventOrder()
- type DayAndTime
- type Event
- func (event *Event) CanBeResizedBy(delta int) bool
- func (event *Event) CanMoveBy(minutes int, snapMinsMod int) bool
- func (event *Event) CanMoveTo(newStart Timestamp) bool
- func (e *Event) Clone() *Event
- func (e *Event) Duration() int
- func (b *Event) IsContainedIn(a *Event) bool
- func (e *Event) MoveBy(duration int, snapMinsMod int) error
- func (e *Event) MoveTo(newStart Timestamp) error
- func (e *Event) ResizeBy(delta int) error
- func (e *Event) Snap(minuteResolution int)
- func (b *Event) StartsDuring(a *Event) bool
- type Goal
- type RangedGoal
- type SunTimes
- type Task
- type TasksByDeadline
- type TimeOffset
- type TimesheetEntry
- type Timestamp
- func (t1 Timestamp) DurationInMinutesUntil(t2 Timestamp) int
- func (t1 Timestamp) DurationUntil(t2 Timestamp) time.Duration
- func (a Timestamp) IsAfter(b Timestamp) bool
- func (a Timestamp) IsBefore(b Timestamp) bool
- func (t Timestamp) Legal() bool
- func (t Timestamp) Offset(o TimeOffset) Timestamp
- func (t Timestamp) OffsetMinutes(minutes int) Timestamp
- func (t Timestamp) Snap(minutesModulus int) Timestamp
- func (a Timestamp) ToString() string
- type WorkweekGoal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoalForRange ¶
GoalForRange is a helper to sum up the duration for the given range expected by the given Goal.
Types ¶
type Backlog ¶ added in v0.8.0
Backlog holds Tasks which can be popped out of the backlog to a concrete timeslot. Backlogging Tasks is a planning mechanism; the Backlog can be seen as a to-do list.
func BacklogFromReader ¶ added in v0.8.0
BacklogFromReader reads and deserializes a backlog from the io.Reader and returns the backlog.
func (*Backlog) Locate ¶ added in v0.8.0
func (b *Backlog) Locate(task *Task) (prev *Task, next *Task, parentage []*Task, index int, err error)
Locate the given task, i.e. give its neighbors and parentage. Returns an error when the task cannot be found.
type BacklogStored ¶ added in v0.8.0
BacklogStored.
type BaseTask ¶ added in v0.8.0
type BaseTask struct { Name string `yaml:"name"` Duration *time.Duration `yaml:"duration,omitempty"` Deadline *time.Time `yaml:"deadline,omitempty"` Subtasks []BaseTask `yaml:"subtasks,omitempty"` }
BaseTask.
type ByStartConsideringDuration ¶
type ByStartConsideringDuration []*Event
func (ByStartConsideringDuration) Len ¶
func (a ByStartConsideringDuration) Len() int
func (ByStartConsideringDuration) Less ¶
func (a ByStartConsideringDuration) Less(i, j int) bool
func (ByStartConsideringDuration) Swap ¶
func (a ByStartConsideringDuration) Swap(i, j int)
type Date ¶
func FromString ¶
func (Date) DaysUntil ¶
Returns the number of days from a date A until a date B is reached. (e.g. from 2021-12-14 until 2021-12-19 -> 5 days) expects b not to be before a
func (Date) GetDayInMonth ¶
GetDayInMonth returns the indexed day in the month of the receiver.
Note that indexing 0 will return the first of the month.
func (Date) GetDayInWeek ¶
GetDayInWeek returns the date that is on the weekday for the given index in the week the receiver is in.
Index here means that 0 is Monday, 6 is Sunday.
func (Date) GetLastOfMonth ¶
GetLastOfMonth returns the last date of the month of the receiver.
func (Date) GetSunTimes ¶
Warning: slow (TODO)
func (Date) MonthBounds ¶
type Day ¶
func NewDayWithEvents ¶
func (*Day) CurrentNext ¶
func (day *Day) CurrentNext()
func (*Day) CurrentPrev ¶
func (day *Day) CurrentPrev()
func (*Day) Flatten ¶
func (day *Day) Flatten()
"Flattens" the events of a given day, i.E. ensures that no overlapping events exist. It does this by e.g. trimming one of two overlapping events or splitting a less prioritized event if it had a higher-priority event occur during it as shown here:
+-------+ +-------+ | a | | a | (`a` lower prio than `B`) | +-----+ +-------+ | | B | ~~> | B | | +-----+ +-------+ | | | a | +-------+ +-------+ +-------+ +-------+ | a | | a | (`a` lower prio than `B`) | +-----+ +-------+ | | B | ~~> | B | +---| | | | +-----+ +-------+
func (*Day) GetEventsFrom ¶
TODO(ja-he): remove
func (*Day) GetNextEventAfter ¶
func (*Day) GetPrevEventBefore ¶
func (*Day) GetTimesheetEntry ¶ added in v0.9.0
func (day *Day) GetTimesheetEntry(matcher func(string) bool) TimesheetEntry
GetTimesheetEntry returns the TimesheetEntry for this day for a given category (e.g. "work").
func (*Day) MoveEventsPushingBy ¶
func (*Day) MoveSingleEventBy ¶
func (*Day) MoveSingleEventTo ¶
func (*Day) RemoveEvent ¶
func (*Day) SplitEvent ¶
func (*Day) SumUpByCategory ¶
Sum up the event durations of a given day per category. Time cannot be counted multiple times, so if multiple events overlap, only one of them can have the time of the overlap counted. The prioritization for this is according to category priority.
func (*Day) UpdateEventOrder ¶
func (day *Day) UpdateEventOrder()
type DayAndTime ¶
func FromTime ¶
func FromTime(t time.Time) *DayAndTime
type Event ¶
type Event struct { Name string `dpedit:"name"` Cat Category `dpedit:"category"` Start Timestamp `dpedit:",ignore"` End Timestamp `dpedit:",ignore"` }
func (*Event) CanBeResizedBy ¶
func (*Event) IsContainedIn ¶
Whether one event A contains another B, i.E. - B's start is _not before_ A's start and - B's end is _not after_ A's end
func (*Event) StartsDuring ¶
Whether one event B starts during another A.
type Goal ¶
Goal defines a time goal. It can be queried, for any given date, what duration the goal requires.
type RangedGoal ¶
type RangedGoal struct {
Entries []rangedGoalEntry
}
RangedGoal is a Goal that is defined by any number of ranges and the expected duration for each.
func NewRangedGoalFromConfig ¶
func NewRangedGoalFromConfig(cfg []config.RangedGoal) (*RangedGoal, error)
NewRangedGoalFromConfig constructs a new RangedGoal from config data.
type Task ¶ added in v0.8.0
type Task struct { Name string `dpedit:"name"` Category Category `dpedit:"category"` Duration *time.Duration `dpedit:"duration"` Deadline *time.Time `dpedit:"deadline"` Subtasks []*Task `dpedit:",ignore"` }
A Task remains to be done (or dropped) but is not yet scheduled. It has a name and belongs to a category (by name); it can further have a duration (estimate), a deadline (due date) and subtasks.
type TasksByDeadline ¶ added in v0.9.2
type TasksByDeadline []*Task
TasksByDeadline is a sort interface to stort tasks by their deadlines
func (TasksByDeadline) Len ¶ added in v0.9.2
func (a TasksByDeadline) Len() int
func (TasksByDeadline) Less ¶ added in v0.9.2
func (a TasksByDeadline) Less(i, j int) bool
func (TasksByDeadline) Swap ¶ added in v0.9.2
func (a TasksByDeadline) Swap(i, j int)
type TimeOffset ¶
type TimesheetEntry ¶ added in v0.9.0
A TimesheetEntry represents an entry in a common timesheet.
It defines a beginning (i.e. the time you clocked in), an end (i.e. the time you clocked out), and the total length of breaks taken between them.
func (*TimesheetEntry) IsEmpty ¶ added in v0.9.0
func (e *TimesheetEntry) IsEmpty() bool
IsEmpty is a helper to identify empty timesheet entries.
type Timestamp ¶
type Timestamp struct {
Hour, Minute int
}
func NewTimestamp ¶
func NewTimestampFromGotime ¶
func (Timestamp) DurationInMinutesUntil ¶
Returns the duration in minutes between to a given timestamp t2. Does not check that t2 is in fact later!
func (Timestamp) DurationUntil ¶ added in v0.7.8
Returns the duration (time.Duration) to a given timestamp t2. Does not check that t2 is in fact later!
func (Timestamp) Offset ¶
func (t Timestamp) Offset(o TimeOffset) Timestamp
Returns a timestamp offset by a given offset, which can be additive or subtractive. "Loops around", meaning offsetting 0:10 by -1 hour results in 23:10, offsetting 23:10 by +1 hour results in 0:10.
func (Timestamp) OffsetMinutes ¶
type WorkweekGoal ¶
type WorkweekGoal struct { Monday time.Duration Tuesday time.Duration Wednesday time.Duration Thursday time.Duration Friday time.Duration Saturday time.Duration Sunday time.Duration }
WorkweekGoal is a goal that defines the duration per day of the week.
func NewWorkweekGoalFromConfig ¶
func NewWorkweekGoalFromConfig(cfg config.WorkweekGoal) (*WorkweekGoal, error)
NewWorkweekGoalFromConfig constructs a new WorkweekGoal from config data.