fix: add postgres backend
changes: - Add postgres backend - Modified or added table attributes. UpdateDate, ForeignKeys, Booleans - Fix test for sqlite and postgres. Compare json instead the struct.
This commit is contained in:
@ -4,8 +4,9 @@ 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"`
|
||||
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"`
|
||||
UpdateDate *time.Time `json:"update_date" xml:"update_date"`
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ type MeasuredValue struct {
|
||||
ValueType string `json:"value_type" xml:"value_type"`
|
||||
Date time.Time `json:"date" xml:"date"`
|
||||
SensorID string `json:"sensor_id" xml:"sensor_id"`
|
||||
CreationDate *time.Time `json:"creation_date" xml:"creation_date"`
|
||||
CreationDate time.Time `json:"creation_date" xml:"creation_date"`
|
||||
UpdateDate *time.Time `json:"update_date" xml:"update_date"`
|
||||
}
|
||||
|
@ -7,18 +7,19 @@ 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"`
|
||||
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"`
|
||||
UpdateDate *time.Time `json:"update_date" xml:"update_date"`
|
||||
}
|
||||
|
||||
// GetID returns the UUID of the sensor.
|
||||
|
Reference in New Issue
Block a user