read all sensors implemented
This commit is contained in:
parent
8cf9219534
commit
92640d1ad0
@ -116,7 +116,14 @@ func (i *inMemory) ReadSensorValues(sensorID string, from time.Time, to time.Tim
|
||||
}
|
||||
|
||||
func (i *inMemory) ReadAllSensors() ([]Sensor, error) {
|
||||
panic("unimplemented")
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
|
||||
sensors := make([]Sensor, 0, len(i.sensors))
|
||||
for _, s := range i.sensors {
|
||||
sensors = append(sensors, *s)
|
||||
}
|
||||
return sensors, nil
|
||||
}
|
||||
|
||||
type DecoratorRepo struct {
|
||||
|
||||
@ -48,8 +48,5 @@ func (s *Service) GetValues(sensorID string, from, to time.Time) (Sensor, error)
|
||||
}
|
||||
|
||||
func (s *Service) ListSensors() ([]Sensor, error) {
|
||||
|
||||
s.repo.ReadAllSensors()
|
||||
|
||||
return []Sensor{}, nil
|
||||
return s.repo.ReadAllSensors()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user