ctxerrgroup

package
v0.0.1-beta.4 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Context-handling Error Group

Like golang.org/x/sync/errgroup, but handles functions which take a context.

Documentation

Overview

Package ctxerrgroup - Like errgroup, but with more contexts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group wraps golang.org/x/sync/errgroup.Group but makes it slightly easier to add goroutines. Group's undocumented methods directly wrap its embedded errgroup.Group.

func WithContext

func WithContext(ctx context.Context) (*Group, context.Context)

WithContext returns a new Group, similar to errgroup.WithContext.

func (*Group) Go

func (g *Group) Go(f func() error)

func (*Group) GoContext

func (g *Group) GoContext(ctx context.Context, f func(context.Context) error)

GoContext is like errgroup.Group.Go, but passes ctx to the called function. The passed-in context is usually the context returned from WithContext.

func (*Group) SetLimit

func (g *Group) SetLimit(n int)

func (*Group) TryGo

func (g *Group) TryGo(f func() error) bool

func (*Group) Wait

func (g *Group) Wait() error

Jump to

Keyboard shortcuts

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