Documentation ¶
Index ¶
Constants ¶
const TimesheetKeyDateFmt = "2006-01-02"
TimesheetKeyDateFmt is the date formatting string for timesheet keys in the store.
const TrackingStatusDefaultWorkspace = "default"
TrackingStatusDefaultWorkspace is the default workspace to fallback on if one isn't present in the DB, or if the currently active workspace is deleted.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.2.1
type Config struct {
Display ConfigDisplay
}
Config represents the application configuration format.
type ConfigDisplay ¶ added in v0.2.1
type ConfigDisplay struct { TimeFormat xtime.DurationFormat FirstWeekday xtime.Weekday }
ConfigDisplay represents configuration for output.
type Entry ¶
type Entry struct { // The date of the timesheet this entry belongs to. Timesheet string // The hash of this entry. Hash string // The time that this entry was created. Created time.Time // The time that this entry was last updated. Updated time.Time // The note on this entry. Note string // The amount of time logged against this entry. Duration time.Duration // Whether or not this entry's timer is running. IsRunning bool }
Entry represents a timesheet entry.
func NewEntry ¶
func NewEntry() Entry
NewEntry creates a new instance of Entry, with a new random hash, and dates set.
func (Entry) CreatedTimeFormat ¶
CreatedTimeFormat returns an appropriate time format for reporting output that is longer if the entry's created date was not the same as the timesheet it belongs to's date.
func (*Entry) FromMessage ¶
func (e *Entry) FromMessage(message *proto.TrackingEntry)
FromMessage reads a `proto.TrackingEntry` message into this Entry.
func (*Entry) ToMessage ¶
func (e *Entry) ToMessage() *proto.TrackingEntry
ToMessage converts this Entry into a `proto.TrackingEntry`.
func (*Entry) UpdateDuration ¶
func (e *Entry) UpdateDuration()
UpdateDuration adds the difference between the time this entry was last stopped and now to the duration. This also updates `Entry.Updated`.
func (Entry) UpdatedTimeFormat ¶
UpdatedTimeFormat returns an appropriate time format for reporting output that is longer if the entry's updated date was not the same as the timesheet it belongs to's date.
type MigrationsStatus ¶
type MigrationsStatus struct { // Versions is an array of the applied migration versions. Versions []uint }
MigrationsStatus represents the current state of backend migrations.
func NewMigrationsStatus ¶
func NewMigrationsStatus() MigrationsStatus
NewMigrationsStatus creates a new instance of MigrationsStatus.
func (*MigrationsStatus) CurrentVersion ¶
func (m *MigrationsStatus) CurrentVersion() uint
CurrentVersion gets the latest applied migration version.
func (*MigrationsStatus) FromMessage ¶
func (m *MigrationsStatus) FromMessage(message *proto.SysMigrationsStatus)
FromMessage reads a `proto.SysMigrationsStatus` message into this MigrationsStatus.
func (*MigrationsStatus) ToMessage ¶
func (m *MigrationsStatus) ToMessage() *proto.SysMigrationsStatus
ToMessage converts this MigrationsStatus into a `proto.SysMigrationsStatus`.
type Timesheet ¶
type Timesheet struct { // The date of the timesheet. Key string // An array of entries that belong in this timesheet. Entries []Entry }
Timesheet represents a timesheet with entries.
func (*Timesheet) AppendEntry ¶
AppendEntry appends a reference to an entry to the timesheet.
func (*Timesheet) FromMessageWithEntries ¶
func (t *Timesheet) FromMessageWithEntries(message *proto.TrackingTimesheet, entries []Entry)
FromMessageWithEntries reads a `proto.TrackingTimesheet` message into this Timesheet.
func (*Timesheet) RemoveEntry ¶
RemoveEntry removes a reference to an entry from the timesheet.
func (*Timesheet) ToMessage ¶
func (t *Timesheet) ToMessage() *proto.TrackingTimesheet
ToMessage converts this Timesheet to a `proto.TrackingTimesheet`.
type TrackingStatus ¶
type TrackingStatus struct { // Whether or not a (any) entry's timer is running. IsRunning bool // The date of the timesheet currently being tracked. Timesheet string // The hash of the entry currently being tracked. Entry string // The name of the workspace currently being tracked. Workspace string }
TrackingStatus represents the status of what is being tracked currently.
func NewTrackingStatus ¶
func NewTrackingStatus() TrackingStatus
NewTrackingStatus creates a new instance of TrackingStatus.
func (*TrackingStatus) FromMessage ¶
func (s *TrackingStatus) FromMessage(message *proto.SysTrackingStatus)
FromMessage reads a `proto.SysTrackingStatus` message into this TrackingStatus.
func (*TrackingStatus) Start ¶
func (s *TrackingStatus) Start(sheet Timesheet, entry Entry)
Start updates the status to reflect that a given timesheet and entry are being tracked.
func (*TrackingStatus) Stop ¶
func (s *TrackingStatus) Stop()
Stop updates the status to reflect that tracking has ended (at least temporarily).
func (*TrackingStatus) StopAndClear ¶
func (s *TrackingStatus) StopAndClear()
StopAndClear updates the status to reflect that tracking has ended, and we should no longer know about a timesheet or entry.
func (*TrackingStatus) ToMessage ¶
func (s *TrackingStatus) ToMessage() *proto.SysTrackingStatus
ToMessage converts this TrackingStatus into a `proto.SysTrackingStatus`.
type WorkspaceIndex ¶
type WorkspaceIndex struct { // Workspaces is an array of workspace names. Workspaces []string }
WorkspaceIndex represents an index of all workspaces.
func NewWorkspaceIndex ¶
func NewWorkspaceIndex() WorkspaceIndex
NewWorkspaceIndex creates a new instance of WorkspaceIndex.
func (*WorkspaceIndex) FromMessage ¶
func (i *WorkspaceIndex) FromMessage(message *proto.SysWorkspaceIndex)
FromMessage reads a `proto.SysWorkspaceIndex` message into this WorkspaceIndex.
func (*WorkspaceIndex) ToMessage ¶
func (i *WorkspaceIndex) ToMessage() *proto.SysWorkspaceIndex
ToMessage converts this WorkspaceIndex into a `proto.SysWorkspaceIndex`.