concurrent

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteConcurrently

func ExecuteConcurrently[T any](ctx context.Context, funcs map[string]Func[T]) (map[string]T, error)

ExecuteConcurrently executes multiple repository functions concurrently It returns a map of results indexed by the provided keys, and the first error encountered (if any)

func ExecuteConcurrentlyTyped

func ExecuteConcurrentlyTyped[T any, R any](
	ctx context.Context,
	resultBuilder func(map[string]T) (R, error),
	funcs map[string]Func[T],
) (R, error)

ExecuteConcurrentlyTyped executes multiple repository functions concurrently and returns the results in a typed struct This is a more type-safe alternative to ExecuteConcurrently when you know the exact structure of the results

Types

type Func

type Func[T any] func(ctx context.Context) (T, error)

Func is a generic type for repository functions that return a value of type T and an error

type Result

type Result[T any] struct {
	Value T
	Err   error
}

Result ConcurrentResult holds the result of a concurrent repository call

Jump to

Keyboard shortcuts

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