Documentation
¶
Index ¶
Constants ¶
View Source
const (
TimeFormat = "2006-01-02-15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Device ¶
type Device struct { ID int32 `json:"id" yaml:"id" mapstructure:"id,omitempty"` Name string `json:"name" yaml:"name" mapstructure:"name,omitempty"` Description string `json:"description" yaml:"description" mapstructure:"description,omitempty"` Sensors []Sensor `json:"sensors" yaml:"sensors" mapstructure:"sensors,omitempty"` }
Device model
func (*Device) GetDeviceID ¶
GetDeviceID gets device id.
type ISensor ¶
type ISensor interface { GetSensorData(ctx context.Context, format string) ([]Measurment, error) SetSysInfoFile(filepath string) ValidateFormat(format string) error ValidateUnit() error }
ISensor gets and validate sensor measurements.
func CreateMemorySensor ¶
func CreateMemorySensor() ISensor
CreateMemorySensor creates instance of memory sensor.
func CreateTempSensor ¶
func CreateTempSensor() ISensor
CreateTempSensor creates instance of temperature sensor.
func CreateUsageSensor ¶
func CreateUsageSensor() ISensor
CreateUsageSensor creates instance of usage sensor.
type Measurment ¶
type Measurment struct { MeasuredAt string `json:"measuredAt" yaml:"measuredAt"` Value string `json:"value" yaml:"value"` SensorID string `json:"sensorId" yaml:"sensorId"` DeviceID string `json:"deviceId" yaml:"deviceId"` Unit string `json:"unit" yaml:"unit"` }
Measurment is struct type that holds inforamation about different sensor metrics
type Sensor ¶
type Sensor struct { ID int32 `json:"id" yaml:"id" mapstructure:"id,omitempty"` Name string `json:"name" yaml:"name" mapstructure:"name,omitempty"` Description string `json:"description" yaml:"description" mapstructure:"description,omitempty"` Unit string `json:"unit" yaml:"unit" mapstructure:"unit,omitempty"` SensorGroups string `json:"sensorGroups" yaml:"sensorGroups" mapstructure:"group_name,omitempty"` Measurments []Measurment `json:"measurements" yaml:"measurements"` }
Click to show internal directories.
Click to hide internal directories.