async

package
v0.0.0-...-69bdcc1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package async 高性能异步方法调用,支持超时控制、错误检查、自动recover 返回值可多次获取,经测试性能与直接使用WaitGroup、Channel接近

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller[Out any] interface {
	String() string
	SetTimeout(time.Duration) Caller[Out]
	Call() Result[Out]
}

func NewCaller

func NewCaller[Out any](fn func() (Out, error)) Caller[Out]

type Result

type Result[Out any] interface {
	String() string
	Output() Out
	Error() error
	Timeout() time.Duration
	Duration() time.Duration
	Timeouted() bool
	Recovered() any
	Success() error
}

Jump to

Keyboard shortcuts

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