feat(pkg/logfile): support csv and xml logfile
This commit is contained in:
		| @@ -4,11 +4,11 @@ import "time" | ||||
|  | ||||
| // 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"` | ||||
| 	HumidityLogfile    string    `json:"humidity_logfile"` | ||||
| 	TemperatureLogfile string    `json:"temperature_logfile"` | ||||
| 	CreationDate       time.Time `json:"creation_date"` | ||||
| 	DeviceID           string    `json:"device_id" xml:"device_id"` | ||||
| 	DeviceName         string    `json:"device_name" xml:"device_name"` | ||||
| 	DeviceLocation     *string   `json:"device_location" xml:"device_location"` | ||||
| 	DeviceLastContact  time.Time `json:"device_last_contact" xml:"device_last_contact"` | ||||
| 	HumidityLogfile    string    `json:"humidity_logfile" xml:"humidity_logfile"` | ||||
| 	TemperatureLogfile string    `json:"temperature_logfile" xml:"temperature_logfile"` | ||||
| 	CreationDate       time.Time `json:"creation_date" xml:"creation_date"` | ||||
| } | ||||
|   | ||||
| @@ -4,10 +4,11 @@ import "time" | ||||
|  | ||||
| // Humidity ... | ||||
| type Humidity struct { | ||||
| 	HumidityID       string    `json:"humidity_id"` | ||||
| 	HumidityValue    float64   `json:"humidity_value,string"` | ||||
| 	HumidityFromDate time.Time `json:"humidity_from_date"` | ||||
| 	HumidityTillDate time.Time `json:"humidity_till_date"` | ||||
| 	SensorID         string    `json:"sensor_id"` | ||||
| 	CreationDate     time.Time `json:"creation_date"` | ||||
| 	HumidityID       string     `json:"humidity_id" xml:"humidity_id"` | ||||
| 	HumidityValue    float64    `json:"humidity_value,string" xml:"humidity_value"` | ||||
| 	HumidityFromDate time.Time  `json:"humidity_from_date" xml:"humidity_from_date"` | ||||
| 	HumidityTillDate time.Time  `json:"humidity_till_date" xml:"humidity_till_date"` | ||||
| 	SensorID         string     `json:"sensor_id" xml:"sensor_id"` | ||||
| 	CreationDate     *time.Time `json:"creation_date" xml:"creation_date"` | ||||
| 	UpdateDate       *time.Time `json:"update_date" xml:"update_date"` | ||||
| } | ||||
|   | ||||
| @@ -6,25 +6,25 @@ import ( | ||||
| ) | ||||
|  | ||||
| type LED struct { | ||||
| 	LEDID        string    `json:"led_id"` | ||||
| 	LEDName      string    `json:"led_name"` | ||||
| 	LEDLocation  string    `json:"led_location"` | ||||
| 	GPIONumber   *GPIO     `json:"gpio_number"` | ||||
| 	LEDEnabled   bool      `json:"led_enabled"` | ||||
| 	LEDColor     *LEDColor `json:"led_color"` | ||||
| 	DeviceID     string    `json:"device_id"` | ||||
| 	CreationDate time.Time `json:"creation_date"` | ||||
| 	LEDID        string    `json:"led_id" xml:"led_id"` | ||||
| 	LEDName      string    `json:"led_name" xml:"led_name"` | ||||
| 	LEDLocation  string    `json:"led_location" xml:"led_location"` | ||||
| 	GPIONumber   *GPIO     `json:"gpio_number" xml:"gpio_number"` | ||||
| 	LEDEnabled   bool      `json:"led_enabled" xml:"led_enabled"` | ||||
| 	LEDColor     *LEDColor `json:"led_color" xml:"led_color"` | ||||
| 	DeviceID     string    `json:"device_id" xml:"device_id"` | ||||
| 	CreationDate time.Time `json:"creation_date" xml:"creation_date"` | ||||
| } | ||||
|  | ||||
| type RGBLED struct { | ||||
| 	RGBLEDID         string                 `json:"rgbled_id"` | ||||
| 	RGBLEDName       string                 `json:"rgbled_name"` | ||||
| 	RGBLEDLocation   string                 `json:"rgbled_location"` | ||||
| 	BaseColorsToGPIO map[BaseColor]*GPIO    `json:"color_to_gpio"` | ||||
| 	ActionMapping    map[LEDOption]LEDColor `json:"action_mapping"` | ||||
| 	RGBLEDEnabled    bool                   `json:"rgbled_enabled"` | ||||
| 	DeviceID         string                 `json:"device_id"` | ||||
| 	CreationDate     time.Time              `json:"creation_date"` | ||||
| 	RGBLEDID         string                 `json:"rgbled_id" xml:"rgbled_id"` | ||||
| 	RGBLEDName       string                 `json:"rgbled_name" xml:"rgbled_name"` | ||||
| 	RGBLEDLocation   string                 `json:"rgbled_location" xml:"rgb_location"` | ||||
| 	BaseColorsToGPIO map[BaseColor]*GPIO    `json:"color_to_gpio" xml:"color_to_gpio"` | ||||
| 	ActionMapping    map[LEDOption]LEDColor `json:"action_mapping" xml:"action_mapping"` | ||||
| 	RGBLEDEnabled    bool                   `json:"rgbled_enabled" xml:"rgb_enabled"` | ||||
| 	DeviceID         string                 `json:"device_id" xml:"device_id"` | ||||
| 	CreationDate     time.Time              `json:"creation_date" xml:"creation_date"` | ||||
| } | ||||
|  | ||||
| type BaseColor string | ||||
|   | ||||
| @@ -9,16 +9,16 @@ import ( | ||||
|  | ||||
| // 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        *GPIO       `json:"gpio_number"` | ||||
| 	SensorModel       SensorModel `json:"sensor_model"` | ||||
| 	SensorEnabled     bool        `json:"sensor_enabled"` | ||||
| 	SensorLastContact time.Time   `json:"sensor_last_contact"` | ||||
| 	DeviceID          string      `json:"device_id"` | ||||
| 	CreationDate      time.Time   `json:"creation_date"` | ||||
| 	SensorID          string      `json:"sensor_id" xml:"sensor_id"` | ||||
| 	SensorName        string      `json:"sensor_name" xml:"sensor_name"` | ||||
| 	SensorLocation    string      `json:"sensor_location" xml:"sensor_location"` | ||||
| 	WireID            *string     `json:"wire_id" xml:"wire_id"` | ||||
| 	GPIONumber        *GPIO       `json:"gpio_number" xml:"gpio_number"` | ||||
| 	SensorModel       SensorModel `json:"sensor_model" xml:"sensor_model"` | ||||
| 	SensorEnabled     bool        `json:"sensor_enabled" xml:"sensor_enabled"` | ||||
| 	SensorLastContact time.Time   `json:"sensor_last_contact" xml:"sensor_last_contact"` | ||||
| 	DeviceID          string      `json:"device_id" xml:"device_id"` | ||||
| 	CreationDate      time.Time   `json:"creation_date" xml:"creation_date"` | ||||
| } | ||||
|  | ||||
| // JSONDecoder decodes a json into a sensor | ||||
|   | ||||
| @@ -4,11 +4,11 @@ import "time" | ||||
|  | ||||
| // Temperature ... | ||||
| type Temperature struct { | ||||
| 	TemperatureID       string     `json:"temperature_id"` | ||||
| 	TemperatureValue    float64    `json:"temperature_value,string"` | ||||
| 	TemperatureFromDate time.Time  `json:"temperature_from_date"` | ||||
| 	TemperatureTillDate time.Time  `json:"temperature_till_date"` | ||||
| 	SensorID            string     `json:"sensor_id"` | ||||
| 	CreationDate        *time.Time `json:"creation_date"` | ||||
| 	UpdateDate          *time.Time `json:"update_date"` | ||||
| 	TemperatureID       string     `json:"temperature_id" xml:"temperature_id"` | ||||
| 	TemperatureValue    float64    `json:"temperature_value,string" xml:"temperature_value,string"` | ||||
| 	TemperatureFromDate time.Time  `json:"temperature_from_date" xml:"temperature_from_date"` | ||||
| 	TemperatureTillDate time.Time  `json:"temperature_till_date" xml:"temperature_till_date"` | ||||
| 	SensorID            string     `json:"sensor_id" xml:"sensor_id"` | ||||
| 	CreationDate        *time.Time `json:"creation_date" xml:"creation_date"` | ||||
| 	UpdateDate          *time.Time `json:"update_date" xml:"update_date"` | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user