diff options
Diffstat (limited to 'model.go')
-rw-r--r-- | model.go | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -12,7 +12,7 @@ type Entry struct { Date Date From *Time To *Time - Tag *string + Tasks map[int]*time.Duration Comment string } @@ -27,8 +27,13 @@ type Date string type Time string -var timeMatch = regexp.MustCompile("\\d\\d:\\d\\d") -var dateMatch = regexp.MustCompile("\\d\\d\\d\\d-\\d\\d-\\d\\d") +type EntrySubDuration string + +var ( + timeMatch = regexp.MustCompile("[0-9]{2}:[0-9]{2}") + dateMatch = regexp.MustCompile("[0-9]{4}-[0-9]{2}-[0-9]{2}") + subDurationMatch = regexp.MustCompile("[0-9]") +) var ( ErrInvalidTime = errors.New("Invalid time string") @@ -41,7 +46,7 @@ func NewEntry(date Date) *Entry { From: nil, Date: date, To: nil, - Tag: nil, + Tasks: map[int]*time.Duration{}, Comment: "", } |