29 lines
1.2 KiB
Go
29 lines
1.2 KiB
Go
// 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 {
|
|
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 map[string]any `gorm:"column:DATA_SOURCE;type:jsonb;not null;default:'{}'"`
|
|
EventPlan map[string]any `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"`
|
|
}
|
|
|
|
// TableName func respresent return table name of Measurement
|
|
func (Measurement) TableName() string {
|
|
return "MEASUREMENT"
|
|
}
|