gopher_pipes

package module
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 0 Imported by: 0

README

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

Documentation

Overview

Package gopher_pipes provides utilities for reactive programming in golang

Directories

Path Synopsis
examples
Package reactive implements abstractions for connecting generator functions to observers.
Package reactive implements abstractions for connecting generator functions to observers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL