Gopher Pipes
Simple source/sink abstraction around generator functions, channels, and observing.
Import
go get github.com/AndreasChristianson/gopher-pipes
Usage
see the examples folder for more examples.
simple
This example creates a source with four strings, observes them, and prints the observed strings.
Verbose logging is enabled.
package main
import (
"fmt"
"github.com/AndreasChristianson/gopher-pipes/reactive"
)
func main() {
pipe := reactive.Just("Hello", " ", "world", "!\n")
pipe.Observe(func(item string) error {
fmt.Print(item)
return nil
})
pipe.Start()
pipe.AwaitCompletion()
}
complicated
This example polls a persistent redis stream via XREAD
and routes messages to a websocket