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