Documentation
¶
Index ¶
- func All(ctx context.Context) map[string]string
- func Clear(ctx context.Context) context.Context
- func Get(ctx context.Context, key string) (string, bool)
- func Remove(ctx context.Context, key string) context.Context
- func Set(ctx context.Context, key, value string) context.Context
- func SetAll(ctx context.Context, values map[string]string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get retrieves the value associated with a baggage key. If the key isn't found, it returns an empty string.
func Set ¶
Set sets or updates a single baggage key/value pair in the context. If the key already exists, this function overwrites the existing value.
Set clones the entire baggage map on every call. Use it for one-off, standalone updates. If you're writing more than one key as part of the same logical update (e.g. reconciling baggage from another source), call SetAll once instead of Set in a loop — looping Set reclones the whole map on every iteration, which is O(N) clones for N keys instead of one.
func SetAll ¶
SetAll merges multiple key/value pairs into the baggage in a single context write. Equivalent to calling Set once per entry in values, but only clones the baggage map once instead of once per key. Prefer this over a Set loop whenever the key/value pairs are already available together, e.g. when reconciling baggage extracted from another source (headers, another baggage format, etc.) rather than a single standalone update.
Types ¶
This section is empty.