Documentation
¶
Overview ¶
Package activity is what was done over a period, read back from the places the work left a trace — git, Taskwarrior, Jira and the forge — and grouped by year, month, day and hour. It holds no clock and does no I/O: a caller says what today is, and hands it what each source read.
Index ¶
- Constants
- Variables
- type Date
- func (d Date) AddDays(days int) Date
- func (d Date) AddMonths(months int) Date
- func (d Date) Before(other Date) bool
- func (d Date) Day() int
- func (d Date) Month() time.Month
- func (d Date) Start(loc *time.Location) time.Time
- func (d Date) String() string
- func (d Date) Weekday() time.Weekday
- func (d Date) Year() int
- type Day
- type Hour
- type Item
- type Kind
- type Month
- type Period
- type Read
- type Source
- type Summary
- type Week
- type Year
Constants ¶
const MaxDays = 366
MaxDays is the longest period read at once: a year, leap day included.
Variables ¶
var ( // ErrBackwards is a period that ends before it starts. ErrBackwards = errors.New("the period ends before it starts") // ErrTooLong is a period longer than MaxDays. ErrTooLong = errors.New("the period is longer than a year and a day") // ErrNotADate is text that is not a date written year-month-day. ErrNotADate = errors.New("not a date written as YYYY-MM-DD") )
Functions ¶
This section is empty.
Types ¶
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
Date is a day on the calendar, wherever it is: no time and no zone, so a period means the same days whichever clock reads it.
func ParseDate ¶
ParseDate reads a date written year-month-day, refusing a day the month does not have.
func (Date) AddMonths ¶
AddMonths is the date months later, or earlier when months is negative, on the same day of the month, or the month's last where it has no such day.
func (Date) Start ¶
Start is the date's first instant in loc: its midnight, or the first hour the clocks show when they skip midnight. Go places a midnight that never happened an hour before it, on the day before, so it is stepped forward.
type Hour ¶
Hour is an hour on the clock and its items. Label is the hour as the clock showed it; on a day the clocks are turned back, the hour shown twice is two hours, each labeled with its zone so they read apart.
type Item ¶
Item is one thing done: when, what, and what it was done to — a commit's hash, a task's id, an issue's key or a pull request's number — with a link to it where there is one, and the repository it was in when the summary reads more than one.
func Merge ¶
Merge is the items of every list, oldest first, items at the same moment in the order they were listed. It keeps every item: a commit two repositories share is read once by the read that lists them (loop.CommitsRead), by its full hash, where an item's abbreviated Ref could not tell it apart.
type Kind ¶
type Kind int
Kind is what was done.
const ( // Committed is a commit you wrote, at its author date. Committed Kind = iota + 1 // TaskAdded is a task added. TaskAdded // TaskStarted is a task started. TaskStarted // TaskAnnotated is a note added to a task. TaskAnnotated // TaskCompleted is a task done. TaskCompleted // IssueCreated is an issue you reported. IssueCreated // IssueMoved is an issue you moved to another status. IssueMoved // IssueWorked is work you logged on an issue. IssueWorked // IssueCommented is a comment you wrote on an issue. IssueCommented // PullOpened is a pull or merge request you opened. PullOpened // PullMerged is a pull or merge request of yours that was merged. PullMerged // PullReviewed is a pull or merge request you reviewed. PullReviewed )
type Period ¶
Period is the days from From through To, both included.
func NewPeriod ¶
NewPeriod is the days from through to, refusing one that runs backwards or is longer than MaxDays.
func PeriodAsked ¶ added in v0.7.0
PeriodAsked is the period first and last name, each a date written year-month-day or empty when it is not given: both days, one day alone, or the previous working day before today when neither is. Every surface reads a period asked for this way, so each defaults to the same days.
func PreviousWorkingDay ¶
PreviousWorkingDay is the last working day before today through yesterday, so a Monday reads back Friday and the weekend after it.
func (Period) Bounds ¶
Bounds are the period's first instant in loc and the first instant after it, so an instant is in the period when it is at or after the one and before the other.
func (Period) Step ¶
Step is the period moved on by steps of its own length, or back when steps is negative. A whole year steps a year, and a whole month a month, so a month stays a month whatever its days.
type Read ¶
Read is what one source said for a period: its items, whether it had more than it gave, and why it could not be read when it could not — Failed, a source that is set up and refused, or NotSetUp, one with nothing set up to ask, which a summary leaves out rather than calls unread.