低空智控平台 后端go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
1.8 KiB

package model
import "time"
// AlarmCode 告警码字典
type AlarmCode struct {
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
Code string `gorm:"column:code;type:VARCHAR(64);not null;uniqueIndex:idx_code" json:"code"`
Category string `gorm:"column:category;type:VARCHAR(32);not null" json:"category"` // dock / drone
MessageCn string `gorm:"column:message_cn;type:VARCHAR(256);not null" json:"messageCn"`
Level string `gorm:"column:level;type:VARCHAR(16);default:critical" json:"level"`
Source string `gorm:"column:source;type:VARCHAR(128);default:''" json:"source"`
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
}
func (AlarmCode) TableName() string {
return "alarm_code"
}
// Alarm 告警记录
type Alarm struct {
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
DockID string `gorm:"column:dock_id;type:VARCHAR(64);not null" json:"dockId"`
Code string `gorm:"column:code;type:VARCHAR(64);not null" json:"code"`
DeviceType string `gorm:"column:device_type;type:VARCHAR(8);not null" json:"deviceType"` // dock / drone
MessageCn string `gorm:"column:message_cn;type:VARCHAR(256);not null" json:"messageCn"`
Level string `gorm:"column:level;type:VARCHAR(16);not null" json:"level"`
Status string `gorm:"column:status;type:VARCHAR(16);default:active" json:"status"` // active / acknowledged / resolved
TriggeredAt *time.Time `gorm:"column:triggered_at" json:"triggeredAt"`
ResolvedAt *time.Time `gorm:"column:resolved_at" json:"resolvedAt"`
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
}
func (Alarm) TableName() string {
return "alarm"
}