Code Monkey home page Code Monkey logo

go-pipeline's Introduction

go-pipeline

Build Status Coverage Status Go Report Card GoDoc

go-pipeline is a Go library to provide some channel "middleware"-like functionality. It can lead to some clean code when processing various inputs that share a flow.

Runner

The Runner interface provides much of the functionality in the package. It's defined as

type Runner interface {
	Run(chan interface{}) chan interface{}
}

The two implementing types provided are Operator and Flow, where the latter is just a collection of Operators, and both provide a Run method.

Example:

func multiplier(x int) Operator {
	return Operator(func(in chan interface{}, out chan interface{}) {
		for m := range in {
			n := m.(int)
			out <- (int(n) * x)
		}
	})
}

Rate Limiter

This package also provides a RateLimiter function which takes a rate limiter from the "golang.org/x/time/rate" package, and returns an Operator which returns a channel whose input is throttled by the provided rate limiter.

Examples

More examples of how to use the pipeline package can be found in the test files

Contributing

If you'd like to contribute to this project, make sure that you're running go vet and go lint before submitting a pull request. If adding a feature or fixing a bug, please also add a test case verify the new functionality/new fix.

go-pipeline's People

Contributors

sbogacz avatar

Stargazers

BUG-Fly avatar  avatar Duoc Nguyen avatar Chris Plock avatar Robert Muller avatar  avatar ldseraph avatar Seaman Bondarenko avatar Dmitry Vorotilin avatar Michael Robinson avatar Joshua Barratt avatar erlang boy avatar Panda avatar Senthil_M avatar Aleksandr Tihomirov avatar  avatar Michael Angerman avatar  avatar Gabriel Glachant avatar saifuddin avatar Michael Wagner avatar Kotaro Yoshimatsu avatar Kei Kamikawa avatar Masaki ISHIYAMA avatar Yuuki TSUBOUCHI avatar Señor Gus avatar  avatar Wiliam Souza avatar timob avatar JK.Ryan avatar darron froese avatar Oleg Atamanenko avatar Mihai Todor avatar Juan Riaza avatar Denis avatar Anatoliy Plastinin avatar Hiroki Sato avatar Peng Du avatar Andrew Vorobyov avatar Michael S. Manley avatar Michael Leonard avatar  avatar Nikita Vershinin avatar Christian Muehlhaeuser avatar Adrian Lanzafame avatar Mikhail Kulishkin avatar Alain Lefebvre avatar Philipp Muens avatar Pana avatar Shigeru Kitazaki avatar 爱可可-爱生活 avatar  avatar Rogerio Marques avatar  avatar Lifeng Tian avatar Miki Oracle avatar  avatar Márk Bartos avatar Serge Simard avatar Chris Hart avatar Jeff Raubitschek avatar Mathieu Cornic avatar Liam avatar abdul dakkak avatar Changsu Jiang avatar Blain Smith avatar

Watchers

Dan Brown avatar James Cloos avatar  avatar wxcsdb88 avatar  avatar

go-pipeline's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.