2024-11-22 16:41:04 +08:00
|
|
|
// Package orm define database data struct
|
|
|
|
|
package orm
|
|
|
|
|
|
|
|
|
|
import (
|
2024-12-30 16:39:11 +08:00
|
|
|
"time"
|
|
|
|
|
|
2024-11-22 16:41:04 +08:00
|
|
|
"github.com/gofrs/uuid"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Component structure define abstracted info set of electrical component
|
|
|
|
|
type Component struct {
|
2024-12-30 16:39:11 +08:00
|
|
|
ID int64 `gorm:"column:id;primaryKey"`
|
|
|
|
|
GlobalUUID uuid.UUID `gorm:"column:global_uuid"`
|
|
|
|
|
Tag string `gorm:"column:tag"`
|
2025-01-10 16:57:29 +08:00
|
|
|
GridID string `gorm:"column:grid"`
|
|
|
|
|
ZoneID string `gorm:"column:zone"`
|
|
|
|
|
StationID string `gorm:"column:station"`
|
2024-12-30 16:39:11 +08:00
|
|
|
PageID int64 `gorm:"column:page_id"`
|
2024-11-22 16:41:04 +08:00
|
|
|
ComponentType int `gorm:"column:type"`
|
|
|
|
|
Name string `gorm:"column:name"`
|
|
|
|
|
Context string `gorm:"column:context"`
|
2024-12-30 16:39:11 +08:00
|
|
|
Op int `gorm:"column:op"`
|
|
|
|
|
Ts time.Time `gorm:"column:ts"`
|
2024-11-22 16:41:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TableName func respresent return table name of Component
|
|
|
|
|
func (c *Component) TableName() string {
|
2025-01-06 17:00:58 +08:00
|
|
|
return "component"
|
2024-11-22 16:41:04 +08:00
|
|
|
}
|