fix: implement repository test

changes:
- Implement repository test for the sqlite backend
- Add testutils package to start container images
- Remove deprecated till_date in measured values
- Renamed columns of the table humidities, pressures and temperatures
This commit is contained in:
2020-06-01 00:52:54 +02:00
parent 11717679bc
commit 43e9d00dcb
37 changed files with 1073 additions and 267 deletions

View File

@ -4,9 +4,8 @@ import "time"
// Device represent a device with all his settings.
type Device struct {
ID string `json:"id" xml:"id"`
Name string `json:"name" xml:"name"`
Location *string `json:"location" xml:"location"`
LastContact *time.Time `json:"last_contact" xml:"last_contact"`
CreationDate time.Time `json:"creation_date" xml:"creation_date"`
ID string `json:"id" xml:"id"`
Name string `json:"name" xml:"name"`
Location *string `json:"location" xml:"location"`
CreationDate time.Time `json:"creation_date" xml:"creation_date"`
}

View File

@ -11,8 +11,7 @@ type MeasuredValue struct {
ID string `json:"id" xml:"id"`
Value float64 `json:"value,string" xml:"value,string"`
ValueType string `json:"value_type" xml:"value_type"`
FromDate time.Time `json:"from_date" xml:"from_date"`
TillDate time.Time `json:"till_date" xml:"till_date"`
Date time.Time `json:"date" xml:"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"`

View File

@ -7,19 +7,18 @@ import (
// Sensor represents a sensor with all his settings. The struct does not
// contains any read method.
type Sensor struct {
ID string `json:"id" xml:"id"`
Name string `json:"name" xml:"name"`
Location string `json:"location" xml:"location"`
WireID *string `json:"wire_id" xml:"wire_id"`
I2CBus *int `json:"i2c_bus" xml:"i2c_bus"`
I2CAddress *uint8 `json:"i2c_address" xml:"i2c_address"`
GPIONumber string `json:"gpio_number" xml:"gpio_number"`
Model string `json:"model" xml:"model"`
Enabled bool `json:"enabled" xml:"enabled"`
LastContact *time.Time `json:"last_contact" xml:"last_contact"`
TickDuration string `json:"tick_duration" xml:"tick_duration"`
DeviceID string `json:"device_id" xml:"device_id"`
CreationDate time.Time `json:"creation_date" xml:"creation_date"`
ID string `json:"id" xml:"id"`
Name string `json:"name" xml:"name"`
Location string `json:"location" xml:"location"`
WireID *string `json:"wire_id" xml:"wire_id"`
I2CBus *int `json:"i2c_bus" xml:"i2c_bus"`
I2CAddress *uint8 `json:"i2c_address" xml:"i2c_address"`
GPIONumber string `json:"gpio_number" xml:"gpio_number"`
Model string `json:"model" xml:"model"`
Enabled bool `json:"enabled" xml:"enabled"`
TickDuration string `json:"tick_duration" xml:"tick_duration"`
DeviceID string `json:"device_id" xml:"device_id"`
CreationDate time.Time `json:"creation_date" xml:"creation_date"`
}
// GetID returns the UUID of the sensor.