heritage-api/model/device-model.go

46 lines
1.9 KiB
Go
Raw Normal View History

2026-03-13 08:35:54 +00:00
package model
import "time"
type Device struct {
ID string `json:"id" gorm:"type:varchar(32);primaryKey"`
Name string `json:"name" gorm:"type:varchar(128);not null"`
ModelID string `json:"modelId" gorm:"type:varchar(32);index"`
SerialNo string `json:"serialNo" gorm:"type:varchar(64);index"`
StatusCode string `json:"statusCode" gorm:"type:varchar(64);not null;index"`
PointID string `json:"pointId" gorm:"type:varchar(32);index"`
InstalledAt *time.Time `json:"installedAt"`
InstalledImage string `json:"installedImage" gorm:"type:text;not null"`
Channel1ParamID string `json:"channel1ParamId" gorm:"type:varchar(32);index"`
Channel2ParamID string `json:"channel2ParamId" gorm:"type:varchar(32);index"`
Channel3ParamID string `json:"channel3ParamId" gorm:"type:varchar(32);index"`
CreatorUserID string `json:"creatorUserId" gorm:"type:varchar(32);not null;index"`
Remark string `json:"remark" gorm:"type:varchar(255);default:''"`
Deleted bool `json:"deleted" gorm:"not null;default:false;index"`
CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime"`
UpdatedAt time.Time `json:"updatedAt" gorm:"autoUpdateTime"`
}
type DeviceIngestData struct {
ID string `json:"id" gorm:"type:varchar(32);primaryKey"`
DeviceID string `json:"deviceId" gorm:"type:varchar(32);not null;index"`
PointID string `json:"pointId" gorm:"type:varchar(32);not null;index"`
Raw1 string `json:"raw1" gorm:"type:varchar(64);default:''"`
Raw2 string `json:"raw2" gorm:"type:varchar(64);default:''"`
Raw3 string `json:"raw3" gorm:"type:varchar(64);default:''"`
Value1 string `json:"value1" gorm:"type:varchar(64);default:''"`
Value2 string `json:"value2" gorm:"type:varchar(64);default:''"`
Value3 string `json:"value3" gorm:"type:varchar(64);default:''"`
CollectedAt time.Time `json:"collectedAt" gorm:"not null;index"`
Deleted bool `json:"deleted" gorm:"not null;default:false;index"`
}