wait

package
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delay

func Delay(wait time.Duration) error

等待,直到指定时间。

入参:

  • wait: 等待时间。

出参:

  • err: 错误。

func DelayWithContext

func DelayWithContext(ctx context.Context, wait time.Duration) error

等待,直到指定时间,或上下文被取消。

入参:

  • ctx: 上下文。
  • wait: 等待时间。

出参:

  • err: 错误。

func For

func For(condition func(int) (bool, error), timeout time.Duration, interval time.Duration) (bool, error)

等待,直到条件满足或超时。

入参:

  • condition: 条件函数,接收尝试次数作为参数,返回是否满足条件和错误。
  • timeout: 超时时间。
  • interval: 执行条件函数的间隔时间。

出参:

  • ret: 是否满足条件。
  • err: 错误。

func ForWithContext

func ForWithContext(ctx context.Context, condition func(context.Context, int) (bool, error), timeout time.Duration, interval time.Duration) (bool, error)

等待,直到条件满足或超时,或上下文被取消。

入参:

  • ctx: 上下文。
  • condition: 条件函数,接收上下文和尝试次数作为参数,返回是否满足条件和错误。
  • timeout: 超时时间。
  • interval: 执行条件函数的间隔时间。

出参:

  • ret: 是否满足条件。
  • err: 错误。

Types

This section is empty.

Jump to

Keyboard shortcuts

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