Files
status/model/service.go
2025-07-20 23:54:15 +03:00

35 lines
1.1 KiB
Go

package model
type HTTPConfig struct {
Authorization string `json:"authorization"`
}
type ServiceTypeCheckConfig struct {
Version string `json:"version"`
HTTPConfig *HTTPConfig `json:"http_config"`
}
type Service struct {
// Unique ID for entity
ID int `gorm:"primary_key;auto_increment" json:"id"`
// Human-readable service name
Name string `gorm:"size:255;not null" json:"name"`
// Human-readable service description
Description string `gorm:"size:255" json:"description"`
PublicDescription string `gorm:"size:255" json:"public_description"`
Public *bool `gorm:"default:false" json:"public"`
// Host to check, for example 192.168.1.44
Host string `gorm:"size:255;not null" json:"host"`
// Port to check, for example 5432 (postgresql)
Port *int `gorm:"default:null" json:"port"`
// Type for check, for now is TCP or HTTP
Type string `gorm:"size:255;not null" json:"type"`
TypeConfig *ServiceTypeCheckConfig `gorm:"serializer:json" json:"type_config"`
Statuses []Status `gorm:"foreignkey:ServiceID" json:"statuses"`
}
func (Service) TableName() string {
return "service"
}