35 lines
1.5 KiB
Go
35 lines
1.5 KiB
Go
// Package orm define database data struct
|
|
package orm
|
|
|
|
import "time"
|
|
|
|
type Demo struct {
|
|
ID int64 `gorm:"column:id" json:"id"` // 主键 ID
|
|
ComponentID int64 `gorm:"column:component_id" json:"component_id"` // compoent表ID
|
|
Resistance float32 `gorm:"column:resistance" json:"resistance"` // 电阻值
|
|
AnchorV bool `gorm:"column:anchor_v" json:"anchor_v"` // 是否锚定电压
|
|
UVAlarm float32 `gorm:"column:uv_alarm" json:"uv_alarm"` // 欠压告警值
|
|
OVAlarm float32 `gorm:"column:ov_alarm" json:"ov_alarm"` // 过压告警值
|
|
AnchorI bool `gorm:"column:anchor_i" json:"anchor_i"` // 是否锚定电流
|
|
UIAlarm float32 `gorm:"column:ui_alarm" json:"ui_alarm"` // 低电流告警值
|
|
OIAlarm float32 `gorm:"column:oi_alarm" json:"oi_alarm"` // 高电流告警值
|
|
Op int `gorm:"column:op" json:"op"` // 操作人 ID
|
|
Ts time.Time `gorm:"column:ts" json:"ts"` // 操作时间
|
|
}
|
|
|
|
// TableName func respresent return table name of busbar section
|
|
func (d *Demo) TableName() string {
|
|
return "bus_stability"
|
|
}
|
|
|
|
// SetComponentID func implement BasicModelInterface interface
|
|
func (d *Demo) SetComponentID(componentID int64) {
|
|
d.ComponentID = componentID
|
|
return
|
|
}
|
|
|
|
// ReturnTableName func implement BasicModelInterface interface
|
|
func (d *Demo) ReturnTableName() string {
|
|
return "bus_stability"
|
|
}
|