parallel

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package parallel provides versions of slicex functions that execute in parallel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply[S ~[]T, T any](slice S, apply func(item T))

Apply applies a function to each item in the slice. The apply function is called in parallel.

func ApplyWithLimit added in v0.9.4

func ApplyWithLimit[S ~[]T, T any](slice S, apply func(item T), concurrency int)

ApplyWithLimit applies a function to each item in the slice. The apply function is called in parallel with a max concurrency.

func GroupBy

func GroupBy[S ~[]T, T any, R comparable](slice S, predicate func(item T) R) map[R]S

GroupBy returns a map of slices grouped by a key produced by a predicate function. The predicate is called in parallel, and the results are returned in the order they appear in the slice.

func GroupByWithLimit added in v0.9.4

func GroupByWithLimit[S ~[]T, T any, R comparable](slice S, predicate func(item T) R, concurrency int) map[R]S

GroupByWithLimit returns a map of slices grouped by a key produced by a predicate function. The predicate is called in parallel with a max concurrency, and the results are returned in the order they appear in the slice.

func Map

func Map[S ~[]T, T any, R any](slice S, mapper func(item T) R) []R

Map transforms a slice to a slice of another type using a mapper function. The mapper function is called in parallel, and results are returned in order they appear in the slice.

func MapWithLimit added in v0.9.4

func MapWithLimit[S ~[]T, T any, R any](slice S, mapper func(item T) R, concurrency int) []R

MapWithLimit transforms a slice to a slice of another type using a mapper function with a max concurrency. The mapper function is called in parallel, and results are returned in order they appear in the slice.

func Partition

func Partition[S ~[]T, T any](slice S, predicate func(item T) bool) (S, S)

Partition splits a slice into two slices based on a predicate. The predicate is called in parallel, and the results are returned in the order they appear in the slice.

func PartitionWithLimit added in v0.9.4

func PartitionWithLimit[S ~[]T, T any](slice S, predicate func(item T) bool, concurrency int) (S, S)

PartitionWithLimit splits a slice into two slices based on a predicate. The predicate is called in parallel with a max concurrency, and the results are returned in the order they appear in the slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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