boilerplate code
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package sensors
|
||||
|
||||
import "time"
|
||||
|
||||
type SType string
|
||||
|
||||
const (
|
||||
Temperature SType = "temperature"
|
||||
Humidity SType = "humidity"
|
||||
CarbonDioxide SType = "carbon_dioxide"
|
||||
Pressure SType = "pressure"
|
||||
Proximity SType = "proximity"
|
||||
Light SType = "light"
|
||||
// and more...
|
||||
)
|
||||
|
||||
type Sensor struct {
|
||||
SensorID string `json:"sensor_id"`
|
||||
SensorType SType `json:"sensor_type"`
|
||||
SamplingInterval time.Duration `json:"sampling"`
|
||||
ThresholdAbove float64 `json:"thresoldabove"`
|
||||
ThresholdBelow float64 `json:"thresoldbelow"`
|
||||
SensorData *[]SensorData `json:"sensor_data,omitempty"`
|
||||
}
|
||||
|
||||
type SensorData struct {
|
||||
Value float64 `json:"value"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
}
|
||||
Reference in New Issue
Block a user