parallel

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package parallel provides useful convenience helpers for parallel / batch execution

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteChunkAsync added in v1.0.1

func ExecuteChunkAsync[I any, O any](
	tasks []I,
	chunkSize int,
	f func(chunk []I) ([]O, error),
	workerCount int,
) ([]O, error)

ExecuteChunkAsync executes provided data in chunks with pool workers.

func ExecuteChunkSync added in v1.0.1

func ExecuteChunkSync[I any, O any](
	tasks []I,
	chunkSize int,
	f func(chunk []I) ([]O, error),
) ([]O, error)

ExecuteChunkSync executes provided function over tasks in chunks synchronously.

func ExecutePool added in v1.0.1

func ExecutePool[I any, O any](
	tasks []I,
	f func(task I) O,
	workerCount int,
) []O

ExecutePool is a convenience helper that distributes input tasks into workerCount workers then collects the result.

Output values are not expected to have the same order as they came in.

Panics when provided executor panics.

func ExecutePool2 added in v1.0.1

func ExecutePool2[I any, O any](
	tasks []I,
	f func(task I) (O, error),
	workerCount int,
) ([]O, error)

ExecutePool2 is a convenience helper that distributes input tasks into workerCount runners then collects the result.

Output values are not expected to have the same order as they came in.

Fails when either of workers fails with nil res and error, otherwise error is nil and the result is OK.

Types

This section is empty.

Jump to

Keyboard shortcuts

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