feat(model): Add method for getting count of last statuses

This commit is contained in:
2025-08-10 22:20:41 +03:00
parent 57c8c86c3a
commit 7cfa8cc52b

View File

@@ -33,3 +33,17 @@ type Service struct {
func (Service) TableName() string {
return "service"
}
func (s Service) CountLastStatuses(status StatusCode) uint {
var count uint = 0
for i := range s.Statuses {
if s.Statuses[i].Status != status {
break
}
count++
}
return count
}