PKGBUILD/pkg/internal/collect/temperatures.go

21 lines
416 B
Go
Raw Normal View History

package collect
import (
"github.com/volker-raschek/flucky/pkg/types"
)
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
}
}
}