ctxutil

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(ctx context.Context, prefix string, fn func() error, lateFn func(error)) error

Allows fn to return early on ctx cancel. If fn does not return in time, lateFn will run at the end of fn (async).

func CallsState

func CallsState() string

func Retry

func Retry(ctx context.Context, retryPause time.Duration, prefix string, fn func() error, lateFn func(error)) error

func WatchDone

func WatchDone(cancel func(), ctx context.Context) func()

Types

type Ctx

type Ctx struct {
	Parent *Ctx
	// name/value (short names to avoid usage, still exporting it)
	N string
	V interface{}
}

func (*Ctx) Value

func (ctx *Ctx) Value(name string) (interface{}, *Ctx)

func (*Ctx) ValueBool

func (ctx *Ctx) ValueBool(name string) bool

func (*Ctx) ValueInt

func (ctx *Ctx) ValueInt(name string) int

func (*Ctx) WithValue

func (ctx *Ctx) WithValue(name string, value interface{}) *Ctx

Jump to

Keyboard shortcuts

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