Documentation ¶
Index ¶
- func Import(sourceDSNURL *url.URL, destDNSURL *url.URL, flogger logger.Logger, ...) error
- type OptImport
- type Repository
- func (repo *Repository) AddDevices(devices ...*types.Device) error
- func (repo *Repository) AddMeasuredValues(measuredValues ...*types.MeasuredValue) error
- func (repo *Repository) AddOrUpdateDevices(devices ...*types.Device) error
- func (repo *Repository) AddOrUpdateMeasuredValues(measuredValues ...*types.MeasuredValue) error
- func (repo *Repository) AddOrUpdateSensors(sensors ...*types.Sensor) error
- func (repo *Repository) AddSensors(sensors ...*types.Sensor) error
- func (repo *Repository) Close() error
- func (repo *Repository) DisableSensorsByNames(sensorNames ...string) error
- func (repo *Repository) EnableSensorsByNames(sensorNames ...string) error
- func (repo *Repository) GetDevice(deviceID string) (*types.Device, error)
- func (repo *Repository) GetDevices() ([]*types.Device, error)
- func (repo *Repository) GetHumidity(humidityID string) (*types.MeasuredValue, error)
- func (repo *Repository) GetPressure(pressureID string) (*types.MeasuredValue, error)
- func (repo *Repository) GetSensor(sensorID string) (*types.Sensor, error)
- func (repo *Repository) GetSensors(models ...string) ([]*types.Sensor, error)
- func (repo *Repository) GetSensorsByDeviceID(deviceID string) ([]*types.Sensor, error)
- func (repo *Repository) GetTemperature(pressureID string) (*types.MeasuredValue, error)
- func (repo *Repository) RemoveDevices(deviceIDs ...string) error
- func (repo *Repository) RemoveSensors(sensorIDs ...string) error
- func (repo *Repository) RemoveSensorsByNames(sensorNames ...string) error
- func (repo *Repository) RenameSensors(oldName string, newName string) error
- func (repo *Repository) UpdateDevices(devices ...*types.Device) error
- func (repo *Repository) UpdateSensors(sensors ...*types.Sensor) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represent a repository where all devices, sensors and measured values are stored.
func New ¶
func New(dsnURL *url.URL, flogger logger.Logger) (*Repository, error)
New returns a new repository based on the data source name (dsn)
func (*Repository) AddDevices ¶
func (repo *Repository) AddDevices(devices ...*types.Device) error
AddDevices to the repository
func (*Repository) AddMeasuredValues ¶
func (repo *Repository) AddMeasuredValues(measuredValues ...*types.MeasuredValue) error
AddMeasuredValues to the repository
func (*Repository) AddOrUpdateDevices ¶ added in v0.3.0
func (repo *Repository) AddOrUpdateDevices(devices ...*types.Device) error
AddOrUpdateDevices to the repository
func (*Repository) AddOrUpdateMeasuredValues ¶ added in v0.3.0
func (repo *Repository) AddOrUpdateMeasuredValues(measuredValues ...*types.MeasuredValue) error
AddOrUpdateMeasuredValues to the repository
func (*Repository) AddOrUpdateSensors ¶ added in v0.3.0
func (repo *Repository) AddOrUpdateSensors(sensors ...*types.Sensor) error
AddOrUpdateSensors to the repository
func (*Repository) AddSensors ¶
func (repo *Repository) AddSensors(sensors ...*types.Sensor) error
AddSensors to the repository
func (*Repository) Close ¶
func (repo *Repository) Close() error
Close closes the repository and prevents new queries from starting. Close then waits for all queries that have started processing on the server to finish.
func (*Repository) DisableSensorsByNames ¶
func (repo *Repository) DisableSensorsByNames(sensorNames ...string) error
DisableSensorsByNames disable all sensors which match bei their name
func (*Repository) EnableSensorsByNames ¶
func (repo *Repository) EnableSensorsByNames(sensorNames ...string) error
EnableSensorsByNames enable all sensors which match bei their name
func (*Repository) GetDevice ¶
func (repo *Repository) GetDevice(deviceID string) (*types.Device, error)
GetDevice returns a device by his id. If no device has been found, the function returns nil.
func (*Repository) GetDevices ¶
func (repo *Repository) GetDevices() ([]*types.Device, error)
GetDevices returns all devices. If no devices has been found, the function returns nil.
func (*Repository) GetHumidity ¶ added in v0.3.0
func (repo *Repository) GetHumidity(humidityID string) (*types.MeasuredValue, error)
GetHumidity returns a humidity value by id
func (*Repository) GetPressure ¶ added in v0.3.0
func (repo *Repository) GetPressure(pressureID string) (*types.MeasuredValue, error)
GetPressure returns a pressure value by id
func (*Repository) GetSensor ¶
func (repo *Repository) GetSensor(sensorID string) (*types.Sensor, error)
GetSensor returns a sensor by his id. If no sensor has been found, the function returns nil.
func (*Repository) GetSensors ¶
func (repo *Repository) GetSensors(models ...string) ([]*types.Sensor, error)
GetSensors returns all sensors. If no sensors has been found, the function returns nil.
func (*Repository) GetSensorsByDeviceID ¶
func (repo *Repository) GetSensorsByDeviceID(deviceID string) ([]*types.Sensor, error)
GetSensorsByDeviceID returns all sensors by a device id. If no sensor has been found by the id, the function returns nil.
func (*Repository) GetTemperature ¶ added in v0.3.0
func (repo *Repository) GetTemperature(pressureID string) (*types.MeasuredValue, error)
GetTemperature returns a temperature value by id
func (*Repository) RemoveDevices ¶
func (repo *Repository) RemoveDevices(deviceIDs ...string) error
RemoveDevices removes devices by their ids from the repository. Additional all sensors and measured values, which are in relation with the device respectively the sensors will also be deleted.
func (*Repository) RemoveSensors ¶
func (repo *Repository) RemoveSensors(sensorIDs ...string) error
RemoveSensors removes sensors by their ids from the repository. Additional all measured values, which are in relation with the sensor will also be deleted.
func (*Repository) RemoveSensorsByNames ¶
func (repo *Repository) RemoveSensorsByNames(sensorNames ...string) error
RemoveSensorsByNames removes all sensors which match bei their name
func (*Repository) RenameSensors ¶
func (repo *Repository) RenameSensors(oldName string, newName string) error
RenameSensors all sensors which match by their current name to the new name
func (*Repository) UpdateDevices ¶
func (repo *Repository) UpdateDevices(devices ...*types.Device) error
UpdateDevices update devices which are stored into the repository by their id. The id of the device can not be updated.
func (*Repository) UpdateSensors ¶
func (repo *Repository) UpdateSensors(sensors ...*types.Sensor) error
UpdateSensors update sensors which are stored into the repository by their id. The id of the sensor can not be updated.