40 lines
1.6 KiB
Go
40 lines
1.6 KiB
Go
// 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 {
|
|
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"`
|
|
GridID string `gorm:"column:GRID"`
|
|
ZoneID string `gorm:"column:ZONE"`
|
|
StationID 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 map[string]interface{} `gorm:"column:CONNECTION;type:jsonb;default:'{}'"`
|
|
Label map[string]interface{} `gorm:"column:LABEL;type:jsonb;default:'{}'"`
|
|
Context string `gorm:"column:CONTEXT"`
|
|
Op int `gorm:"column:OP"`
|
|
Ts time.Time `gorm:"column:TS"`
|
|
|
|
// TODO 解决删除ID、ComponentType 后的报错
|
|
ID int64 `gorm:"column:id;primaryKey"`
|
|
ComponentType int `gorm:"column:TYPE"`
|
|
}
|
|
|
|
// TableName func respresent return table name of Component
|
|
func (c *Component) TableName() string {
|
|
return "COMPONENT"
|
|
}
|