fix(pkg/logfile): use one instead of several logfiles for all measured values
This commit is contained in:
		| @@ -4,11 +4,10 @@ import "time" | ||||
|  | ||||
| // Device ... | ||||
| type Device struct { | ||||
| 	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"` | ||||
| 	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"` | ||||
| 	Logfile           string    `json:"logfile" xml:"logfile"` | ||||
| 	CreationDate      time.Time `json:"creation_date" xml:"creation_date"` | ||||
| } | ||||
|   | ||||
| @@ -13,6 +13,10 @@ type Humidity struct { | ||||
| 	UpdateDate       *time.Time `json:"update_date" xml:"update_date"` | ||||
| } | ||||
|  | ||||
| func (h *Humidity) GetCreationDate() *time.Time { | ||||
| 	return h.CreationDate | ||||
| } | ||||
|  | ||||
| func (h *Humidity) GetID() string { | ||||
| 	return h.HumidityID | ||||
| } | ||||
| @@ -24,3 +28,15 @@ func (h *Humidity) GetSensorID() string { | ||||
| func (h *Humidity) GetValue() float64 { | ||||
| 	return h.HumidityValue | ||||
| } | ||||
|  | ||||
| func (h *Humidity) SetTillDate(date time.Time) { | ||||
| 	h.HumidityTillDate = date | ||||
| } | ||||
|  | ||||
| func (h *Humidity) SetCreationDate(date *time.Time) { | ||||
| 	h.CreationDate = date | ||||
| } | ||||
|  | ||||
| func (h *Humidity) SetUpdateDate(date *time.Time) { | ||||
| 	h.UpdateDate = date | ||||
| } | ||||
|   | ||||
| @@ -1,7 +1,13 @@ | ||||
| package types | ||||
|  | ||||
| import "time" | ||||
|  | ||||
| type MeasuredValue interface { | ||||
| 	GetID() string | ||||
| 	GetCreationDate() *time.Time | ||||
| 	GetSensorID() string | ||||
| 	GetValue() float64 | ||||
| 	SetCreationDate(date *time.Time) | ||||
| 	SetTillDate(date time.Time) | ||||
| 	SetUpdateDate(date *time.Time) | ||||
| } | ||||
|   | ||||
| @@ -13,6 +13,10 @@ type Temperature struct { | ||||
| 	UpdateDate          *time.Time `json:"update_date" xml:"update_date"` | ||||
| } | ||||
|  | ||||
| func (t *Temperature) GetCreationDate() *time.Time { | ||||
| 	return t.CreationDate | ||||
| } | ||||
|  | ||||
| func (t *Temperature) GetID() string { | ||||
| 	return t.TemperatureID | ||||
| } | ||||
| @@ -24,3 +28,15 @@ func (t *Temperature) GetSensorID() string { | ||||
| func (t *Temperature) GetValue() float64 { | ||||
| 	return t.TemperatureValue | ||||
| } | ||||
|  | ||||
| func (t *Temperature) SetTillDate(date time.Time) { | ||||
| 	t.TemperatureTillDate = date | ||||
| } | ||||
|  | ||||
| func (t *Temperature) SetCreationDate(date *time.Time) { | ||||
| 	t.CreationDate = date | ||||
| } | ||||
|  | ||||
| func (t *Temperature) SetUpdateDate(date *time.Time) { | ||||
| 	t.UpdateDate = date | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user