Documentation
¶
Index ¶
- func Background() (C, CancelFunc)
- func Cause(c C) error
- func GetTracking(c C) string
- func NewError(c C, err error) error
- func NewErrorf(c C, f string, args ...any) error
- func RangeTag(c C, fn func(k string, json JSON) error) error
- func Span(c C, name string) (C, CancelFunc)
- func WithCancel(c C) (C, CancelFunc)
- func WrapError(c C, err error) error
- type C
- type CancelFunc
- type Error
- type JSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Background ¶
func Background() (C, CancelFunc)
func GetTracking ¶
func NewErrorf ¶
creates a new error using the given format and argument if any argument is an error, it will be wrapped as per fmt.Errorf() the error is then given a stack trace and context unless it already has one
func RangeTag ¶
scan the chain of context for tags, call the function on each of them, parents first
func WithCancel ¶
func WithCancel(c C) (C, CancelFunc)
Types ¶
type C ¶
just an alias, so you can type `c ctx.C` instead of `ctx context.Context`
func WithTag ¶
Append the given key/val pair to the context Note(oha): if the same key is added twice, it will be found twice later with the Range
func WithTracking ¶
create a new tracking id embedded in the context, the suggested id can be used if valid, otherwise a new id is created
type CancelFunc ¶
type CancelFunc context.CancelCauseFunc
type JSON ¶
type JSON []byte
just a []byte, but marshal and unmarshal like json.RawMessage and it is printed as string in logs, win win