Files
status/model/status.go
ostiwe fc8b723114 refactor: Fix linter errors by auto-apply
- Apply automated linter fixes
- Manually reformat fields in model/service.go
- Resolve code complexity issues
2025-11-04 19:59:17 +03:00

36 lines
917 B
Go

package model
import (
"time"
"gorm.io/gorm"
)
type StatusCode string
const (
StatusOK StatusCode = "ok" // Means - response ok, service is alive
StatusFailed StatusCode = "failed" // Means - response failed, all tries failed, service down
StatusWarn StatusCode = "warn" // Means - response failed after N tries and still watched
StatusUncheck StatusCode = "uncheck"
)
type Status struct {
ID uint64 `gorm:"primary_key;auto_increment" json:"-"`
ServiceID uint64 `json:"-"`
Status StatusCode `gorm:"size:255;not null" json:"status"`
Description *string `gorm:"size:255" json:"description"`
CreatedAt time.Time `json:"createdAt"`
ResponseTime uint64 `json:"responseTime"`
}
func (Status) TableName() string {
return "statuses"
}
func (s *Status) BeforeCreate(*gorm.DB) error {
s.CreatedAt = time.Now()
return nil
}