Files
aiops/backend/internal/models/resource_model.go
T

26 lines
853 B
Go

package models
import (
"time"
"gorm.io/gorm"
)
// ResourceModel 资源模型 (CMDB 模型定义)
type ResourceModel struct {
ID uint `gorm:"primarykey" json:"id"`
Name string `gorm:"size:64;not null" json:"name"`
Code string `gorm:"size:64;uniqueIndex;not null" json:"code"`
Description string `gorm:"size:500" json:"description"`
Type string `gorm:"size:32;default:normal" json:"type"` // normal, parent
Attributes string `gorm:"type:text" json:"attributes"` // JSON 数组
Icon string `gorm:"size:64" json:"icon"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
func (ResourceModel) TableName() string {
return "resource_models"
}