Back to godoc.org

Package xgo

v0.2.4
Latest Go to latest
Published: 1 day ago | License: Apache-2.0 | Module: github.com/douyu/jupiter

Index

Package Files

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 ...

type WhenError

type WhenError int

策略注入

var (

	// ReturnWhenError ...
	ReturnWhenError WhenError = 1

	// ContinueWhenError ...
	ContinueWhenError WhenError = 2

	// PanicWhenError ...
	PanicWhenError WhenError = 3

	// LastErrorWhenError ...
	LastErrorWhenError WhenError = 4
)
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier