parallel

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(handler interface{}, parInputs interface{}, parallelism int) interface{}

Run execute handler on parInputs, with automatic type conversion and maximum concurrency as parallelism Examples: > out := Run(func(x int) int { return x*x }, []int{1,2,3,4,5}, 5) < out: []int{1,4,19,16,25} > out := Run(func(x int, y string) (string, bool) { return y, x%2==0 }, [][]interface{}{{1,"n"},{2,"y"}}, 2) < out: [][]interface{{"n",false},{"y",true}}

Types

type ParInput

type ParInput interface{}

ParInput input for parallel execution

type ParOutput

type ParOutput interface{}

ParOutput output for parallel execution

func RunBatch

func RunBatch(handler func(ParInput) ParOutput, parInputs []ParInput, parallelism int) []ParOutput

RunBatch parallel execute handler function on parInputs, with maximum concurrency as parallelism

Jump to

Keyboard shortcuts

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