xgo

package
v0.0.0-...-b804f52 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MulanPSL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelayGo

func DelayGo(delay time.Duration, fn func())

DelayGo goroutine

func Go

func Go(fn func())

Go goroutine

func GoDirect

func GoDirect(fn interface{}, args ...interface{})

GoDirect ...

func Parallel

func Parallel(fns ...func()) func()

Parallel 并发执行

func ParallelWithError

func ParallelWithError(fns ...func() error) func() error

ParallelWithError ...

func ParallelWithErrorChan

func ParallelWithErrorChan(fns ...func() error) chan error

ParallelWithErrorChan calls the passed functions in a goroutine, returns a chan of errors fns会并发执行,chan error

func RestrictParallel

func RestrictParallel(restrict int, fns ...func()) func()

RestrictParallel 并发,最大并发量restrict

func RestrictParallelWithErrorChan

func RestrictParallelWithErrorChan(concurrency int, fns ...func() error) chan error

RestrictParallelWithErrorChan calls the passed functions in a goroutine, limiting the number of goroutines running at the same time, returns a chan of errors

func SafeGo

func SafeGo(fn func(), rec func(error))

SafeGo safe go

func Serial

func Serial(fns ...func()) func()

Serial 串行

func SerialUntilError

func SerialUntilError(fns ...func() error) func() error

创建一个迭代器

func SerialWhenError

func SerialWhenError(we WhenError) func(fn ...func() error) func() error

SerialWhenError ...

func SerialWithError

func SerialWithError(fns ...func() error) func() error

SerialWithError ...

Types

type WhenError

type WhenError int

策略注入

var (

	// ReturnWhenError ...
	ReturnWhenError WhenError = 1

	// ContinueWhenError ...
	ContinueWhenError WhenError = 2

	// PanicWhenError ...
	PanicWhenError WhenError = 3

	// LastErrorWhenError ...
	LastErrorWhenError WhenError = 4
)

Jump to

Keyboard shortcuts

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