Add ImportResult.UpdateTimestamp method

This commit is contained in:
Philipp Wolfer 2023-11-15 18:37:36 +01:00
parent 298697dcfc
commit 729a3d0ed0
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
6 changed files with 39 additions and 30 deletions

View file

@ -92,3 +92,27 @@ func (l LovesList) Less(i, j int) bool {
func (l LovesList) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
type ListensResult struct {
Error error
Listens ListensList
}
type LovesResult struct {
Error error
Loves LovesList
}
type ImportResult struct {
TotalCount int
ImportCount int
LastTimestamp time.Time
ImportErrors []string
}
// Sets LastTimestamp to newTime, if newTime is newer than LastTimestamp
func (i *ImportResult) UpdateTimestamp(newTime time.Time) {
if newTime.Unix() > i.LastTimestamp.Unix() {
i.LastTimestamp = newTime
}
}