refactor: temperature
This commit is contained in:
@ -1,97 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Checkpoint ...
|
||||
type Checkpoint struct {
|
||||
CheckpointID string `json:"checkpoint_id"`
|
||||
CheckpointDate time.Time `json:"checkpoint_date,string"`
|
||||
RFID string `json:"rfid"`
|
||||
ProductID string `json:"product_id"`
|
||||
SensorID string `json:"sensor_id"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
||||
|
||||
// Device ...
|
||||
type Device struct {
|
||||
DeviceID string `json:"device_id"`
|
||||
DeviceName *string `json:"device_name"`
|
||||
DeviceLocation *string `json:"device_location"`
|
||||
DeviceLastContact time.Time `json:"device_last_contact"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
||||
|
||||
// Failnoise ...
|
||||
type Failnoise struct {
|
||||
FailnoiseID string `json:"failnoise_id"`
|
||||
FailnoiseCounter int `json:"failnoise_counter,string"`
|
||||
FailnoiseStartDate time.Time `json:"failnoise_start_date"`
|
||||
FailnoiseEndDate time.Time `json:"failnoise_end_date"`
|
||||
SensorID string `json:"sensor_id"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
||||
|
||||
// Humidity ...
|
||||
type Humidity struct {
|
||||
HumidityID string `json:"humidity_id"`
|
||||
HumidityValue float64 `json:"humidity_value,string"`
|
||||
HumidityDate time.Time `json:"humidity_date"`
|
||||
SensorID string `json:"sensor_id"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
||||
|
||||
// Knock ...
|
||||
type Knock struct {
|
||||
KnockID string `json:"knock_id"`
|
||||
KnockCounter int `json:"knock_counter,string"`
|
||||
KnockStartDate time.Time `json:"knock_start_date"`
|
||||
KnockEndDate time.Time `json:"knock_end_date"`
|
||||
SensorID string `json:"sensor_id"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
||||
|
||||
// Sensor ...
|
||||
type Sensor struct {
|
||||
SensorID string `json:"sensor_id"`
|
||||
SensorName *string `json:"sensor_name"`
|
||||
SensorLocation *string `json:"sensor_location"`
|
||||
WireID *string `json:"wire_id"`
|
||||
GPIONumber *string `json:"gpio_number"`
|
||||
SensorType *string `json:"sensor_type"`
|
||||
SensorEnabled *bool `json:"sensor_enabled"`
|
||||
SensorLastContact time.Time `json:"sensor_last_contact"`
|
||||
DeviceID string `json:"device_id"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
||||
|
||||
// ReadableSensorName returns a readable sensor name
|
||||
func (s *Sensor) ReadableSensorName() string {
|
||||
if s.SensorName != nil {
|
||||
return *s.SensorName
|
||||
}
|
||||
if s.WireID != nil {
|
||||
return *s.WireID
|
||||
}
|
||||
return s.SensorID
|
||||
}
|
||||
|
||||
// Temperature ...
|
||||
type Temperature struct {
|
||||
TemperatureID string `json:"temperature_id"`
|
||||
TemperatureValue float64 `json:"temperature_value,string"`
|
||||
TemperatureDate time.Time `json:"temperature_date"`
|
||||
SensorID string `json:"sensor_id"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
||||
|
||||
// Throughput ...
|
||||
type Throughput struct {
|
||||
ThroughputID string `json:"throughput_id"`
|
||||
ThroughputAverage float64 `json:"throughput_average,string"`
|
||||
ThroughputStartDate time.Time `json:"throughput_start_date"`
|
||||
ThroughputEndDate time.Time `json:"throughput_end_date"`
|
||||
SensorID string `json:"sensor_id"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
}
|
Reference in New Issue
Block a user