wait

package
v0.4.15 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 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 Until added in v0.4.15

func Until(condition func(index int) (bool, error), interval time.Duration) (bool, error)

等待直到条件满足。

入参:

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

出参:

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

func UntilTimeout added in v0.4.15

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

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

入参:

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

出参:

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

func UntilTimeoutWithContext added in v0.4.15

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

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

入参:

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

出参:

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

func UntilWithContext added in v0.4.15

func UntilWithContext(ctx context.Context, condition func(ctx context.Context, index int) (bool, error), interval time.Duration) (bool, error)

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

入参:

  • ctx: 上下文。
  • condition: 条件函数,接收上下文和尝试次数作为参数,返回是否满足条件和错误。
  • 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