modelRT/orm/circuit_diagram_component.go

36 lines
1.2 KiB
Go
Raw Normal View History

// Package orm define database data struct
package orm
import (
"time"
"github.com/gofrs/uuid"
)
// Component structure define abstracted info set of electrical component
type Component struct {
2025-11-19 17:44:08 +08:00
GlobalUUID uuid.UUID `gorm:"column:global_uuid;primaryKey"`
NsPath string `gorm:"column:nspath"`
Tag string `gorm:"column:tag"`
Name string `gorm:"column:name"`
ModelName string `gorm:"column:model_name"`
Description string `gorm:"column:description"`
GridTag string `gorm:"column:grid"`
ZoneTag string `gorm:"column:zone"`
StationTag string `gorm:"column:station"`
Type int `gorm:"column:type"`
InService bool `gorm:"column:in_service"`
State int `gorm:"column:state"`
Status int `gorm:"column:status"`
Connection JSONMap `gorm:"column:connection;type:jsonb;default:'{}'"`
Label JSONMap `gorm:"column:label;type:jsonb;default:'{}'"`
Context JSONMap `gorm:"column:context;type:jsonb;default:'{}'"`
Op int `gorm:"column:op"`
Ts time.Time `gorm:"column:ts"`
}
// TableName func respresent return table name of Component
func (c *Component) TableName() string {
2025-11-19 17:44:08 +08:00
return "component"
}