pipe

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 4 Imported by: 0

README

pipe

Go Reference

Simple library for pipeline building.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute[T any](ctx context.Context, pipeline Pipeline[T], in T) (out T, err error)

Execute starts pipeline processing.

func Parallel

func Parallel[T any](ctx context.Context, pipeline Pipeline[[]T], in []T, jobs int) (out []T, err error)

Parallel distributes 'in' batch between jobs and executes piplene inside of separated routines. Order of results will be same as input.

Types

type HandlerFunc

type HandlerFunc[T any] func(ctx context.Context, in T) (out T, err error)

func ForEach

func ForEach[T any](handle HandlerFunc[T]) HandlerFunc[[]T]

ForEach returns new handler over []T with applied handle function to every element.

type Pipeline

type Pipeline[T any] []HandlerFunc[T]

Jump to

Keyboard shortcuts

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