Documentation ¶
Overview ¶
Package metadata provides support for the propagation of metadata information from a component method caller to the callee. The metadata is propagated to the callee even if the caller and callee are not colocated in the same process.
The metadata is a map from string to string stored in context.Context. The map can be added to a context by calling NewContext.
Example:
To attach metadata with key "foo" and value "bar" to the context:
ctx := context.Background() ctx = metadata.NewContext(ctx, map[string]string{"foo": "bar"})
To read the metadata value associated with a key "foo" in the context:
meta, found := metadata.FromContext(ctx) if found { value := meta["foo"] }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the metadata value stored in ctx, if any.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.