36 lines
1.2 KiB
Go
36 lines
1.2 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"`
|
|
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 {
|
|
return "component"
|
|
}
|