diff options
author | Julian T <julian@jtle.dk> | 2024-05-26 22:20:40 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2024-05-29 22:25:47 +0200 |
commit | afb0a04fe600575b00d551da7dce6a08679ef7b8 (patch) | |
tree | 8f90720887cf49045d65a9d17dad984dae06275c /model.go | |
parent | 9b55b16f3b906958171b4f45002b58d5f77b9705 (diff) |
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: "", } |