2025-08-15 16:25:48 +08:00
|
|
|
// Package orm define database data struct
|
2025-08-13 16:24:29 +08:00
|
|
|
package orm
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/gofrs/uuid"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Bay structure define abstracted info set of electrical bay
|
|
|
|
|
type Bay struct {
|
2025-11-19 17:44:08 +08:00
|
|
|
BayUUID uuid.UUID `gorm:"column:bay_uuid;type:uuid;primaryKey;default:gen_random_uuid()"`
|
|
|
|
|
Name string `gorm:"column:name;size:64;not null;default:''"`
|
|
|
|
|
Tag string `gorm:"column:tag;size:32;not null;default:''"`
|
|
|
|
|
Type string `gorm:"column:type;size:64;not null;default:''"`
|
|
|
|
|
Unom float64 `gorm:"column:unom;not null;default:-1"`
|
|
|
|
|
Fla float64 `gorm:"column:fla;not null;default:-1"`
|
|
|
|
|
Capacity float64 `gorm:"column:capacity;not null;default:-1"`
|
|
|
|
|
Description string `gorm:"column:description;size:512;not null;default:''"`
|
|
|
|
|
InService bool `gorm:"column:in_service;not null;default:false"`
|
|
|
|
|
State int `gorm:"column:state;not null;default:-1"`
|
|
|
|
|
Grid string `gorm:"column:grid;size:64;not null;default:''"`
|
|
|
|
|
Zone string `gorm:"column:zone;size:64;not null;default:''"`
|
|
|
|
|
Station string `gorm:"column:station;size:64;not null;default:''"`
|
|
|
|
|
Business JSONMap `gorm:"column:business;type:jsonb;not null;default:'{}'"`
|
|
|
|
|
Context JSONMap `gorm:"column:context;type:jsonb;not null;default:'{}'"`
|
|
|
|
|
FromUUIDs []uuid.UUID `gorm:"column:from_uuids;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
ToUUIDs []uuid.UUID `gorm:"column:to_uuids;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
DevProtect JSONMap `gorm:"column:dev_protect;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
DevFaultRecord JSONMap `gorm:"column:dev_fault_record;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
DevStatus JSONMap `gorm:"column:dev_status;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
DevDynSense JSONMap `gorm:"column:dev_dyn_sense;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
DevInstruct JSONMap `gorm:"column:dev_instruct;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
DevEtc JSONMap `gorm:"column:dev_etc;type:jsonb;not null;default:'[]'"`
|
|
|
|
|
Components []uuid.UUID `gorm:"column:components;type:uuid[];not null;default:'{}'"`
|
|
|
|
|
Op int `gorm:"column:op;not null;default:-1"`
|
|
|
|
|
Ts time.Time `gorm:"column:ts;type:timestamptz;not null;default:CURRENT_TIMESTAMP"`
|
2025-08-13 16:24:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TableName func respresent return table name of Bay
|
2025-11-19 17:44:08 +08:00
|
|
|
func (b *Bay) TableName() string {
|
|
|
|
|
return "bay"
|
2025-08-13 16:24:29 +08:00
|
|
|
}
|