Documentation ¶
Overview ¶
Package metadata define the structure of the metadata supported by gRPC library. Please refer to https://grpc.io/docs/guides/wire.html for more information about custom-metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeKeyValue ¶
DecodeKeyValue returns k, v, nil. It is deprecated and should not be used.
func NewContext ¶
NewContext is a wrapper for NewOutgoingContext(ctx, md). Deprecated.
func NewIncomingContext ¶ added in v1.3.0
NewIncomingContext creates a new context with incoming md attached.
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 FromContext ¶
FromContext is a wrapper for FromIncomingContext(ctx). Deprecated.
func FromIncomingContext ¶ added in v1.3.0
FromIncomingContext returns the incoming metadata in ctx if it exists. The returned MD should not be modified. Writing to it may cause races. Modification should be made to copies of the returned MD.
func FromOutgoingContext ¶ added in v1.3.0
FromOutgoingContext returns the outgoing metadata in ctx if it exists. The returned MD should not be modified. Writing to it may cause races. Modification should be made to the copies of the returned MD.
func Join ¶ added in v1.0.2
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.