Help us shape the future of Go! Take the 2026 Go Developer Survey

wait

package
v1.33.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func New

func New(f WaitFn) *Handler

New creates a new Handler instance with sensible defaults

func (*Handler) SetInitialDelay added in v1.33.2

func (w *Handler) SetInitialDelay(d time.Duration) *Handler

SetInitialDelay sets an optional delay before the first poll is executed. This is useful when an operation is known to need time before its status changes.

func (*Handler) SetThrottle

func (w *Handler) SetThrottle(d time.Duration) (*Handler, error)

SetThrottle sets the duration between each poll. Returns *Handler for chaining.

func (*Handler) SetTimeout

func (w *Handler) SetTimeout(d time.Duration) *Handler

SetTimeout sets the maximum duration before Wait times out. Returns *Handler for chaining.

func (*Handler) Wait

func (w *Handler) Wait() (interface{}, error)

Wait starts polling until the WaitFn returns done, an error occurs, or the timeout is reached.

func (*Handler) WaitWithContext added in v1.8.0

func (w *Handler) WaitWithContext(ctx context.Context) (res interface{}, err error)

WaitWithContext starts polling until the WaitFn returns done, an error occurs, the provided context is cancelled, or the timeout is reached.

type WaitFn

type WaitFn func() (res interface{}, done bool, err error)

Jump to

Keyboard shortcuts

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