boilerplate code

This commit is contained in:
2025-10-09 05:20:06 +02:00
parent a7c436fe4c
commit b51f00e499
17 changed files with 500 additions and 17 deletions
+29
View File
@@ -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"`
}