Skip to content

hymkor/go-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipeline Supporter

example :

With Go 1.18 Generics, any type's channel can be used for pipeline.

package main

import (
    "fmt"

    "github.com/hymkor/go-pipeline"
)

func main() {
    fmt.Println("Start")
    pipeline.Run(func(in, out chan int) {
        for i := 0; i < 10; i++ {
            out <- i
        }
    }, func(in, out chan int) {
        for value := range in {
            out <- value + 1
        }
    }, func(in, out chan int) {
        for value := range in {
            fmt.Printf("%d\n", value)
        }
    })
    fmt.Println("Done.")
}

About

channel + goroutine -> pipeline

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages