MCPcopy Create free account
hub / github.com/DoNewsCode/core / Inject

Function Inject

ctxmeta/ctxmeta.go:238–240  ·  view source on GitHub ↗

Inject constructs a Baggage object and injects it into the provided context under the default context key. Use the returned context for all further operations. The returned Data can be queried at any point for metadata collected over the life of the context.

(ctx context.Context)

Source from the content-addressed store, hash-verified

236// operations. The returned Data can be queried at any point for metadata
237// collected over the life of the context.
238func Inject(ctx context.Context) (*Baggage, context.Context) {
239 return DefaultMetadata.Inject(ctx)
240}
241
242// GetBaggage returns the default Baggage stored in the context.
243func GetBaggage(ctx context.Context) *Baggage {

Callers 6

TestWithContextFunction · 0.92
ExampleWithContextFunction · 0.92
ServeHTTPMethod · 0.92
ExampleBaggage_UnmarshalFunction · 0.92
ExampleDAG_runFunction · 0.92
TestMetadata_globalFunction · 0.85

Calls 1

InjectMethod · 0.80

Tested by 6

TestWithContextFunction · 0.74
ExampleWithContextFunction · 0.74
ServeHTTPMethod · 0.74
ExampleBaggage_UnmarshalFunction · 0.74
ExampleDAG_runFunction · 0.74
TestMetadata_globalFunction · 0.68