2019-06-13 19:25:32 +00:00
|
|
|
package collect
|
|
|
|
|
2019-06-15 13:58:41 +00:00
|
|
|
import "github.com/go-flucky/flucky/pkg/types"
|
2019-06-13 19:25:32 +00:00
|
|
|
|
|
|
|
func Humidities(humidityChannel <-chan *types.Humidity) []*types.Humidity {
|
|
|
|
humidityList := make([]*types.Humidity, 0)
|
|
|
|
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case hum, more := <-humidityChannel:
|
|
|
|
if more {
|
|
|
|
humidityList = append(humidityList, hum)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
default:
|
|
|
|
return humidityList
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|