21 lines
376 B
Go
21 lines
376 B
Go
package collect
|
|
|
|
import "github.com/go-flucky/flucky/pkg/types"
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|