Skip to content

AndreasChristianson/gopher-pipes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gopher Pipes

main-build coverage Go Reference

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 using XREAD (via go-redis) and routes messages to a websocket

// todo