Documentation ¶
Overview ¶
Package data contains all the data manipulation logic for punchcard
Index ¶
- func CheckEntry(w *WorkLogEntry, projects ProjectMap) error
- func WriteData(path string, pcd *PunchcardData) error
- type Project
- type ProjectMap
- type PunchcardData
- func (pcd *PunchcardData) AddEntry(entry *WorkLogEntry) error
- func (pcd *PunchcardData) AddProject(p *Project) error
- func (pcd *PunchcardData) FinishCurrent(t time.Time) error
- func (pcd *PunchcardData) GetLastEntry() *WorkLogEntry
- func (pcd *PunchcardData) GetLastEntryForProject(name string) *WorkLogEntry
- func (pcd *PunchcardData) RenameProject(oldName string, newName string) error
- func (pcd *PunchcardData) SetCurrent(entry *WorkLogEntry) error
- type WorkLog
- type WorkLogEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEntry ¶
func CheckEntry(w *WorkLogEntry, projects ProjectMap) error
CheckEntry validates a WorkLogEntry
func WriteData ¶
func WriteData(path string, pcd *PunchcardData) error
WriteData reads all the data from the data file
Types ¶
type Project ¶
type Project struct { Name string Description string Reference string `yaml:",omitempty"` Closed bool `yaml:",omitempty"` }
Project is a container for WorkLogEntry objects. I.e. every WorkLogEntry belongs to a Project.
type ProjectMap ¶
ProjectMap maps the Project.Name to the Project
type PunchcardData ¶
type PunchcardData struct { Projects ProjectMap Entries WorkLog Current *WorkLogEntry `yaml:",omitempty"` }
PunchcardData is the overall type for data stored
func ReadData ¶
func ReadData(path string) (*PunchcardData, error)
ReadData reads all the data from the data file
func (*PunchcardData) AddEntry ¶
func (pcd *PunchcardData) AddEntry(entry *WorkLogEntry) error
AddEntry adds a WorkLogEntry to the data
func (*PunchcardData) AddProject ¶
func (pcd *PunchcardData) AddProject(p *Project) error
AddProject adds a Project to the data
func (*PunchcardData) FinishCurrent ¶
func (pcd *PunchcardData) FinishCurrent(t time.Time) error
FinishCurrent finishes the Current and adds it to Entries
func (*PunchcardData) GetLastEntry ¶
func (pcd *PunchcardData) GetLastEntry() *WorkLogEntry
GetLastEntry returns the last WorkLogEntry in the list
func (*PunchcardData) GetLastEntryForProject ¶
func (pcd *PunchcardData) GetLastEntryForProject(name string) *WorkLogEntry
GetLastEntryForProject returns the last WorkLogEntry in the list for project
func (*PunchcardData) RenameProject ¶ added in v0.3.0
func (pcd *PunchcardData) RenameProject(oldName string, newName string) error
RenameProject renames a Project and the entries
func (*PunchcardData) SetCurrent ¶
func (pcd *PunchcardData) SetCurrent(entry *WorkLogEntry) error
SetCurrent adds a WorkLogEntry as the current