2025-08-13 16:24:29 +08:00
|
|
|
// Package orm define database data struct
|
|
|
|
|
package orm
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/gofrs/uuid"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Measurement structure define abstracted info set of electrical measurement
|
|
|
|
|
type Measurement struct {
|
2025-11-19 17:44:08 +08:00
|
|
|
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
|
|
|
|
Tag string `gorm:"column:tag;size:64;not null;default:''"`
|
|
|
|
|
Name string `gorm:"column:name;size:64;not null;default:''"`
|
|
|
|
|
Type int16 `gorm:"column:type;not null;default:-1"`
|
|
|
|
|
Size int `gorm:"column:size;not null;default:-1"`
|
|
|
|
|
DataSource JSONMap `gorm:"column:data_source;type:jsonb;not null;default:'{}'"`
|
|
|
|
|
EventPlan JSONMap `gorm:"column:event_plan;type:jsonb;not null;default:'{}'"`
|
|
|
|
|
BayUUID uuid.UUID `gorm:"column:bay_uuid;type:uuid;not null"`
|
|
|
|
|
ComponentUUID uuid.UUID `gorm:"column:component_uuid;type:uuid;not null"`
|
|
|
|
|
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 Measurement
|
|
|
|
|
func (Measurement) TableName() string {
|
2025-11-19 17:44:08 +08:00
|
|
|
return "measurement"
|
2025-08-13 16:24:29 +08:00
|
|
|
}
|