refactor: mqtt data model.
This commit is contained in:
+57
-30
@@ -4,40 +4,62 @@ import "gorm.io/gorm"
|
||||
|
||||
type MqttHeartRateRecord struct {
|
||||
gorm.Model
|
||||
Identifier string `gorm:"uniqueIndex;size:255" json:"identifier"`
|
||||
Topic string `gorm:"size:255;index" json:"topic"`
|
||||
RegionID uint32 `gorm:"index" json:"regionId"`
|
||||
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
||||
BandID uint32 `gorm:"index" json:"bandId"`
|
||||
BeltAddr string `gorm:"size:64;index" json:"beltAddr"`
|
||||
PacketNum uint32 `gorm:"index" json:"packetNum"`
|
||||
HeartRate int `gorm:"type:int" json:"heartRate"`
|
||||
HrConfidence int `gorm:"type:int" json:"hrConfidence"`
|
||||
IsActive bool `json:"isActive"`
|
||||
IsOnSkin bool `json:"isOnSkin"`
|
||||
Battery uint32 `json:"battery"`
|
||||
SignalRSSINeg float64 `gorm:"type:double precision" json:"signalRssiNeg"`
|
||||
SNR float64 `gorm:"type:double precision" json:"snr"`
|
||||
HubBusID uint32 `json:"hubBusId"`
|
||||
HubSubDevID uint32 `json:"hubSubDevId"`
|
||||
ReceivedAt int64 `gorm:"type:bigint;index" json:"receivedAt"`
|
||||
Identifier string `gorm:"uniqueIndex;size:255" json:"identifier"`
|
||||
Topic string `gorm:"size:255;index" json:"topic"`
|
||||
RegionID uint32 `gorm:"index" json:"regionId"`
|
||||
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
||||
GatewaySchemaVersion uint32 `json:"gatewaySchemaVersion"`
|
||||
GatewayActiveUplink int32 `gorm:"type:int" json:"gatewayActiveUplink"`
|
||||
GatewayCellularIMEI string `gorm:"size:64" json:"gatewayCellularImei"`
|
||||
GatewayCellularRSSI int32 `gorm:"type:int" json:"gatewayCellularRssi"`
|
||||
GatewayCellularBER int32 `gorm:"type:int" json:"gatewayCellularBer"`
|
||||
BandID uint32 `gorm:"index" json:"bandId"`
|
||||
BeltAddr string `gorm:"size:64;index" json:"beltAddr"`
|
||||
PacketNum uint32 `gorm:"index" json:"packetNum"`
|
||||
HeartRate int `gorm:"type:int" json:"heartRate"`
|
||||
HrConfidence int `gorm:"type:int" json:"hrConfidence"`
|
||||
IsActive bool `json:"isActive"`
|
||||
IsOnSkin bool `json:"isOnSkin"`
|
||||
Battery uint32 `json:"battery"`
|
||||
PacketStatusSource string `gorm:"size:16" json:"packetStatusSource"`
|
||||
SignalRSSINeg float64 `gorm:"type:double precision" json:"signalRssiNeg"`
|
||||
SNR float64 `gorm:"type:double precision" json:"snr"`
|
||||
RawSignalRSSIX2Neg uint32 `json:"rawSignalRssiX2Neg"`
|
||||
RawSnrPktX4 int32 `gorm:"type:int" json:"rawSnrPktX4"`
|
||||
HubBusID uint32 `json:"hubBusId"`
|
||||
HubSubDevID uint32 `json:"hubSubDevId"`
|
||||
HubRadioBW int32 `gorm:"type:int" json:"hubRadioBw"`
|
||||
HubRadioSF uint32 `json:"hubRadioSf"`
|
||||
HubRadioFrequencyMHz float64 `gorm:"type:double precision" json:"hubRadioFrequencyMHz"`
|
||||
ReceivedAt int64 `gorm:"type:bigint;index" json:"receivedAt"`
|
||||
}
|
||||
|
||||
type MqttStepCountRecord struct {
|
||||
gorm.Model
|
||||
Identifier string `gorm:"uniqueIndex;size:255" json:"identifier"`
|
||||
Topic string `gorm:"size:255;index" json:"topic"`
|
||||
RegionID uint32 `gorm:"index" json:"regionId"`
|
||||
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
||||
BandID uint32 `gorm:"index" json:"bandId"`
|
||||
BeltAddr string `gorm:"size:64;index" json:"beltAddr"`
|
||||
PacketNum uint32 `gorm:"index" json:"packetNum"`
|
||||
StepCount uint32 `json:"stepCount"`
|
||||
SignalRSSINeg float64 `gorm:"type:double precision" json:"signalRssiNeg"`
|
||||
SNR float64 `gorm:"type:double precision" json:"snr"`
|
||||
HubBusID uint32 `json:"hubBusId"`
|
||||
HubSubDevID uint32 `json:"hubSubDevId"`
|
||||
ReceivedAt int64 `gorm:"type:bigint;index" json:"receivedAt"`
|
||||
Identifier string `gorm:"uniqueIndex;size:255" json:"identifier"`
|
||||
Topic string `gorm:"size:255;index" json:"topic"`
|
||||
RegionID uint32 `gorm:"index" json:"regionId"`
|
||||
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
||||
GatewaySchemaVersion uint32 `json:"gatewaySchemaVersion"`
|
||||
GatewayActiveUplink int32 `gorm:"type:int" json:"gatewayActiveUplink"`
|
||||
GatewayCellularIMEI string `gorm:"size:64" json:"gatewayCellularImei"`
|
||||
GatewayCellularRSSI int32 `gorm:"type:int" json:"gatewayCellularRssi"`
|
||||
GatewayCellularBER int32 `gorm:"type:int" json:"gatewayCellularBer"`
|
||||
BandID uint32 `gorm:"index" json:"bandId"`
|
||||
BeltAddr string `gorm:"size:64;index" json:"beltAddr"`
|
||||
PacketNum uint32 `gorm:"index" json:"packetNum"`
|
||||
StepCount uint32 `json:"stepCount"`
|
||||
PacketStatusSource string `gorm:"size:16" json:"packetStatusSource"`
|
||||
SignalRSSINeg float64 `gorm:"type:double precision" json:"signalRssiNeg"`
|
||||
SNR float64 `gorm:"type:double precision" json:"snr"`
|
||||
RawSignalRSSIX2Neg uint32 `json:"rawSignalRssiX2Neg"`
|
||||
RawSnrPktX4 int32 `gorm:"type:int" json:"rawSnrPktX4"`
|
||||
HubBusID uint32 `json:"hubBusId"`
|
||||
HubSubDevID uint32 `json:"hubSubDevId"`
|
||||
HubRadioBW int32 `gorm:"type:int" json:"hubRadioBw"`
|
||||
HubRadioSF uint32 `json:"hubRadioSf"`
|
||||
HubRadioFrequencyMHz float64 `gorm:"type:double precision" json:"hubRadioFrequencyMHz"`
|
||||
ReceivedAt int64 `gorm:"type:bigint;index" json:"receivedAt"`
|
||||
}
|
||||
|
||||
type MqttGatewayStatusRecord struct {
|
||||
@@ -46,6 +68,11 @@ type MqttGatewayStatusRecord struct {
|
||||
Topic string `gorm:"size:255;index" json:"topic"`
|
||||
RegionID uint32 `gorm:"index" json:"regionId"`
|
||||
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
||||
GatewaySchemaVersion uint32 `json:"gatewaySchemaVersion"`
|
||||
GatewayActiveUplink int32 `gorm:"type:int" json:"gatewayActiveUplink"`
|
||||
GatewayCellularIMEI string `gorm:"size:64" json:"gatewayCellularImei"`
|
||||
GatewayCellularRSSI int32 `gorm:"type:int" json:"gatewayCellularRssi"`
|
||||
GatewayCellularBER int32 `gorm:"type:int" json:"gatewayCellularBer"`
|
||||
BootCount uint32 `json:"bootCount"`
|
||||
UptimeMs uint32 `json:"uptimeMs"`
|
||||
DurationMsSinceLastPacket uint32 `json:"durationMsSinceLastPacket"`
|
||||
|
||||
Reference in New Issue
Block a user