This commit is contained in:
zxr
2026-03-30 18:03:40 +08:00
parent 279021bf86
commit c152a9e573
6 changed files with 474 additions and 51 deletions

View File

@@ -2,16 +2,26 @@ package models
import "time"
// TrapDictionaryEntry 表示 Trap 字典条目,用于描述某个 OID 前缀对应的告警元信息。
type TrapDictionaryEntry struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
OIDPrefix string `gorm:"size:512;uniqueIndex" json:"oid_prefix"`
Title string `gorm:"size:512" json:"title"`
Description string `gorm:"type:text" json:"description"`
SeverityCode string `gorm:"size:32" json:"severity_code"`
RecoveryMessage string `gorm:"type:text" json:"recovery_message"`
Enabled bool `gorm:"default:true" json:"enabled"`
// ID 是数据库主键。
ID uint `gorm:"primaryKey" json:"id"`
// CreatedAt 记录创建时间GORM 自动维护)。
CreatedAt time.Time `json:"created_at"`
// UpdatedAt 记录更新时间GORM 自动维护)。
UpdatedAt time.Time `json:"updated_at"`
// OIDPrefix 表示该字典条目对应的 OID 前缀(唯一)。
OIDPrefix string `gorm:"size:512;uniqueIndex" json:"oid_prefix"`
// Title 表示字典条目的标题。
Title string `gorm:"size:512" json:"title"`
// Description 表示字典条目的说明文本。
Description string `gorm:"type:text" json:"description"`
// SeverityCode 表示默认严重级别编码。
SeverityCode string `gorm:"size:32" json:"severity_code"`
// RecoveryMessage 表示恢复/消警时的消息模板内容。
RecoveryMessage string `gorm:"type:text" json:"recovery_message"`
// Enabled 表示该字典条目是否启用。
Enabled bool `gorm:"default:true" json:"enabled"`
}
func (TrapDictionaryEntry) TableName() string {