24 lines
404 B
Go
24 lines
404 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/probakowski/go-satel"
|
||
|
)
|
||
|
|
||
|
func FilterByType(ev <-chan satel.Event, allowedTypes []satel.ChangeType) <-chan satel.Event {
|
||
|
returnChan := make(chan satel.Event)
|
||
|
|
||
|
go func() {
|
||
|
for e := range ev {
|
||
|
for _, allowedType := range allowedTypes {
|
||
|
if allowedType == e.Type {
|
||
|
returnChan <- e
|
||
|
continue
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
close(returnChan)
|
||
|
}()
|
||
|
|
||
|
return returnChan
|
||
|
}
|