await

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout    = values.Errorf(0, "timeout")
	ErrServerBusy = values.Errorf(1, "server busy,try again later")
)

Functions

This section is empty.

Types

type Await

type Await struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func New

func New(cap int, timeout time.Duration) *Await

func (*Await) Call

func (this *Await) Call(handle Handle, args any) (any, error)

Call 同步调用handle并返回结果

func (*Await) Sync

func (this *Await) Sync(handle Handle, args any) *Message

Sync 异步执行,不关心执行结果 也可以使用 Message.Done等待返回结果

func (*Await) Try

func (this *Await) Try(handle Handle, args any) (any, error)

Try 如果通道已满,立即放弃执行

type Handle

type Handle func(args any) (reply any, err error)

type Initialize

type Initialize struct {
	// contains filtered or unexported fields
}

Initialize 并发模式下初始化控制器

func NewInitialize

func NewInitialize() *Initialize

func (*Initialize) Try added in v1.2.0

func (i *Initialize) Try(f func() error) (err error)

type Message

type Message struct {
	// contains filtered or unexported fields
}

func (*Message) Wait added in v1.2.0

func (this *Message) Wait(t time.Duration) (any, error)

Jump to

Keyboard shortcuts

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