fx

package
v0.3.32 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Break

func Break()

func CallerName

func CallerName(skip int) string

CallerName ...

func CancelCtx added in v0.3.27

func CancelCtx() (ctx context.Context, cancel context.CancelFunc)

func CostWith

func CostWith(fn func()) time.Duration

func Count

func Count(n int) <-chan int

func Delay

func Delay(dur time.Duration, fn func()) error

func FnName

func FnName(i interface{}) string

FnName ...

func Go

func Go(fn func(ctx context.Context)) context.CancelFunc

Go 启动一个goroutine

func GoDelay

func GoDelay(fn func(), dur ...time.Duration)

GoDelay 延迟goroutine

func GoLoop

func GoLoop(fn func(ctx Ctx)) context.CancelFunc

GoLoop 启动一个goroutine loop 是为了替换 `go func() {for{ }}()` 这类的代码

func Loop

func Loop(fn func(i int)) error

func MemStatsPrint

func MemStatsPrint()

func ObjectName

func ObjectName(i interface{}) string

ObjectName ...

func Tick

func Tick(fn func(ctx Ctx), interval ...time.Duration) context.CancelFunc

Tick 简单定时器

func Timeout

func Timeout(dur time.Duration, fn func()) error

Timeout 执行超时函数, 超时后, 函数自动退出

func Wrap

func Wrap(fn interface{}) func(...interface{}) func(...interface{})

func WrapRaw

func WrapRaw(fn interface{}) func(...interface{}) []reflect.Value

func WrapReflect

func WrapReflect(fn interface{}) func(...reflect.Value) []reflect.Value

func WrapValue

func WrapValue(fn interface{}, args ...interface{}) []reflect.Value

Types

type Ctx added in v0.3.27

type Ctx struct {
	context.Context
}

func (Ctx) Break added in v0.3.27

func (Ctx) Break()

Jump to

Keyboard shortcuts

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