Documentation ¶
Index ¶
- type Database
- type SqliteDevicesDatabase
- func (db *SqliteDevicesDatabase) AddCommand(command *command.Command) error
- func (db *SqliteDevicesDatabase) AddDevice(device *device.Device) error
- func (database *SqliteDevicesDatabase) AddRule(rule *rules.Rule) error
- func (db *SqliteDevicesDatabase) AddSensor(sensor *sensor.Sensor) error
- func (db *SqliteDevicesDatabase) AddSensorValue(data *value.SensorValue) error
- func (db *SqliteDevicesDatabase) DeleteCommand(deviceId, commandId string) error
- func (db *SqliteDevicesDatabase) DeleteDevice(id string) error
- func (db *SqliteDevicesDatabase) DeleteSensor(deviceId, sensorId string) error
- func (db *SqliteDevicesDatabase) GetCommand(deviceId, commandId string) (*command.Command, error)
- func (db *SqliteDevicesDatabase) GetCurrentSensorValue(deviceId, sensorId string) (*value.SensorValue, error)
- func (db *SqliteDevicesDatabase) GetDevice(id string) (*device.Device, error)
- func (db *SqliteDevicesDatabase) GetPreviousSensorValue(deviceId, sensorId string) (*value.SensorValue, error)
- func (db *SqliteDevicesDatabase) GetSensor(deviceId, sensorId string) (*sensor.Sensor, error)
- func (db *SqliteDevicesDatabase) GetSensorValuesSince(deviceId, sensorId string, timestamp time.Time) ([]value.SensorValue, error)
- func (db *SqliteDevicesDatabase) ListCommands(deviceId string) ([]command.Command, error)
- func (db *SqliteDevicesDatabase) ListDevices() ([]device.Device, error)
- func (db *SqliteDevicesDatabase) ListPollingSensors() ([]sensor.Sensor, error)
- func (database *SqliteDevicesDatabase) ListRules() ([]rules.Rule, error)
- func (db *SqliteDevicesDatabase) ListSensors(deviceId string) ([]sensor.Sensor, error)
- func (database *SqliteDevicesDatabase) SeedDatabase()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { AddDevice(entity *device.Device) error GetDevice(id string) (*device.Device, error) DeleteDevice(id string) error ListDevices() ([]device.Device, error) ListSensors(deviceId string) ([]sensor.Sensor, error) AddSensor(sensor *sensor.Sensor) error GetSensor(deviceId, sensorId string) (*sensor.Sensor, error) DeleteSensor(deviceId, sensorId string) error ListPollingSensors() ([]sensor.Sensor, error) AddSensorValue(sensorValue *value.SensorValue) error GetSensorValuesSince(deviceId, sensorId string, timestamp time.Time) ([]value.SensorValue, error) GetCurrentSensorValue(deviceId, sensorId string) (*value.SensorValue, error) GetPreviousSensorValue(deviceId, sensorId string) (*value.SensorValue, error) AddCommand(command *command.Command) error GetCommand(deviceId, commandId string) (*command.Command, error) ListCommands(deviceId string) ([]command.Command, error) DeleteCommand(deviceId, commandId string) error ListRules() ([]rules.Rule, error) AddRule(rule *rules.Rule) error SeedDatabase() }
type SqliteDevicesDatabase ¶
type SqliteDevicesDatabase struct {
// contains filtered or unexported fields
}
func NewDevicesDatabase ¶
func NewDevicesDatabase(db *gorm.DB) (*SqliteDevicesDatabase, error)
func (*SqliteDevicesDatabase) AddCommand ¶
func (db *SqliteDevicesDatabase) AddCommand(command *command.Command) error
func (*SqliteDevicesDatabase) AddDevice ¶
func (db *SqliteDevicesDatabase) AddDevice(device *device.Device) error
func (*SqliteDevicesDatabase) AddRule ¶
func (database *SqliteDevicesDatabase) AddRule(rule *rules.Rule) error
func (*SqliteDevicesDatabase) AddSensor ¶
func (db *SqliteDevicesDatabase) AddSensor(sensor *sensor.Sensor) error
func (*SqliteDevicesDatabase) AddSensorValue ¶
func (db *SqliteDevicesDatabase) AddSensorValue(data *value.SensorValue) error
func (*SqliteDevicesDatabase) DeleteCommand ¶
func (db *SqliteDevicesDatabase) DeleteCommand(deviceId, commandId string) error
func (*SqliteDevicesDatabase) DeleteDevice ¶
func (db *SqliteDevicesDatabase) DeleteDevice(id string) error
func (*SqliteDevicesDatabase) DeleteSensor ¶
func (db *SqliteDevicesDatabase) DeleteSensor(deviceId, sensorId string) error
func (*SqliteDevicesDatabase) GetCommand ¶
func (db *SqliteDevicesDatabase) GetCommand(deviceId, commandId string) (*command.Command, error)
func (*SqliteDevicesDatabase) GetCurrentSensorValue ¶
func (db *SqliteDevicesDatabase) GetCurrentSensorValue(deviceId, sensorId string) (*value.SensorValue, error)
func (*SqliteDevicesDatabase) GetDevice ¶
func (db *SqliteDevicesDatabase) GetDevice(id string) (*device.Device, error)
func (*SqliteDevicesDatabase) GetPreviousSensorValue ¶
func (db *SqliteDevicesDatabase) GetPreviousSensorValue(deviceId, sensorId string) (*value.SensorValue, error)
func (*SqliteDevicesDatabase) GetSensor ¶
func (db *SqliteDevicesDatabase) GetSensor(deviceId, sensorId string) (*sensor.Sensor, error)
func (*SqliteDevicesDatabase) GetSensorValuesSince ¶
func (db *SqliteDevicesDatabase) GetSensorValuesSince(deviceId, sensorId string, timestamp time.Time) ([]value.SensorValue, error)
func (*SqliteDevicesDatabase) ListCommands ¶
func (db *SqliteDevicesDatabase) ListCommands(deviceId string) ([]command.Command, error)
func (*SqliteDevicesDatabase) ListDevices ¶
func (db *SqliteDevicesDatabase) ListDevices() ([]device.Device, error)
func (*SqliteDevicesDatabase) ListPollingSensors ¶
func (db *SqliteDevicesDatabase) ListPollingSensors() ([]sensor.Sensor, error)
func (*SqliteDevicesDatabase) ListRules ¶
func (database *SqliteDevicesDatabase) ListRules() ([]rules.Rule, error)
func (*SqliteDevicesDatabase) ListSensors ¶
func (db *SqliteDevicesDatabase) ListSensors(deviceId string) ([]sensor.Sensor, error)
func (*SqliteDevicesDatabase) SeedDatabase ¶
func (database *SqliteDevicesDatabase) SeedDatabase()
Click to show internal directories.
Click to hide internal directories.