ogo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT 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 @Description: goroutine @param delay @param fn

func Go

func Go(fn func())

Go @Description: goroutine @param fn

func GoDirect

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

GoDirect @Description: @param fn @param args

func IsChanClosed

func IsChanClosed(ch <-chan struct{}) bool

func Parallel

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

Parallel @Description: 并发执行 @param fns @return func()

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 @Description: 并发,最大并发量restrict @param restrict @param fns @return func()

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 @Description: safe go @param fn @param rec

func Serial

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

Serial @Description: 串行 @param fns @return func()

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