refactor(model): Refactor Status model
This commit is contained in:
@@ -6,18 +6,20 @@ import (
|
|||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type StatusCode string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
StatusOK = "ok" // Means - response ok, service is alive
|
StatusOK StatusCode = "ok" // Means - response ok, service is alive
|
||||||
StatusFailed = "failed" // Means - response failed, all tries failed, service down
|
StatusFailed StatusCode = "failed" // Means - response failed, all tries failed, service down
|
||||||
StatusWarn = "warn" // Means - response failed after N tries and still watched
|
StatusWarn StatusCode = "warn" // Means - response failed after N tries and still watched
|
||||||
)
|
)
|
||||||
|
|
||||||
type Status struct {
|
type Status struct {
|
||||||
ID int `gorm:"primary_key;auto_increment" json:"-"`
|
ID int `gorm:"primary_key;auto_increment" json:"-"`
|
||||||
ServiceID int `gorm:"one" json:"-"`
|
ServiceID int `gorm:"one" json:"-"`
|
||||||
Status string `gorm:"size:255;not null" json:"status"`
|
Status StatusCode `gorm:"size:255;not null" json:"status"`
|
||||||
Description *string `gorm:"size:255" json:"description"`
|
Description *string `gorm:"size:255" json:"description"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Status) TableName() string {
|
func (Status) TableName() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user