Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToOutgoingContext ¶
AppendToOutgoingContext returns a new context with the provided kv merged with any existing metadata in the context. Please refer to the documentation of Pairs for a description of kv.
func NewIncomingContext ¶
NewIncomingContext creates a new context with incoming md attached. md must not be modified after calling this function.
func NewOutgoingContext ¶
NewOutgoingContext creates a new context with outgoing md attached. If used in conjunction with AppendToOutgoingContext, NewOutgoingContext will overwrite any previously-appended metadata. md must not be modified after calling this function.
Types ¶
type MD ¶
MD is a mapping from metadata keys to values. Users should use the following two convenience functions New and Pairs to generate MD.
func FromIncomingContext ¶
FromIncomingContext returns the incoming metadata in ctx if it exists.
All keys in the returned MD are lowercase.
func FromOutgoingContext ¶
FromOutgoingContext returns the outgoing metadata in ctx if it exists.
All keys in the returned MD are lowercase.
func Join ¶
Join joins any number of mds into a single MD.
The order of values for each key is determined by the order in which the mds containing those values are presented to Join.
func New ¶
New creates an MD from a given key-value map.
Only the following ASCII characters are allowed in keys:
- digits: 0-9
- uppercase letters: A-Z (normalized to lower)
- lowercase letters: a-z
- special characters: -_.
Uppercase letters are automatically converted to lowercase.
func Pairs ¶
Pairs returns an MD formed by the mapping of key, value ... Pairs panics if len(kv) is odd.
Only the following ASCII characters are allowed in keys:
- digits: 0-9
- uppercase letters: A-Z (normalized to lower)
- lowercase letters: a-z
- special characters: -_.
Uppercase letters are automatically converted to lowercase.
func (MD) Append ¶
Append adds the values to key k, not overwriting what was already stored at that key.
k is converted to lowercase before storing in md.
func (MD) Delete ¶
Delete removes the values for a given key k which is converted to lowercase before removing it from md.