metadata
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package metadata define the structure of the metadata supported by gRPC library.Please refer tohttps://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.mdfor more information about custom-metadata.
Index¶
- func AppendToOutgoingContext(ctx context.Context, kv ...string) context.Context
- func DecodeKeyValue(k, v string) (string, string, error)deprecated
- func NewIncomingContext(ctx context.Context, md MD) context.Context
- func NewOutgoingContext(ctx context.Context, md MD) context.Context
- func ValueFromIncomingContext(ctx context.Context, key string) []string
- type MD
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcAppendToOutgoingContext¶added inv1.10.0
AppendToOutgoingContext returns a new context with the provided kv mergedwith any existing metadata in the context. Please refer to the documentationof Pairs for a description of kv.
funcDecodeKeyValuedeprecated
funcNewIncomingContext¶added inv1.3.0
NewIncomingContext creates a new context with incoming md attached. md mustnot be modified after calling this function.
funcNewOutgoingContext¶added inv1.3.0
NewOutgoingContext creates a new context with outgoing md attached. If usedin conjunction with AppendToOutgoingContext, NewOutgoingContext willoverwrite any previously-appended metadata. md must not be modified aftercalling this function.
Types¶
typeMD¶
MD is a mapping from metadata keys to values. Users should use the followingtwo convenience functions New and Pairs to generate MD.
funcFromIncomingContext¶added inv1.3.0
FromIncomingContext returns the incoming metadata in ctx if it exists.
All keys in the returned MD are lowercase.
funcFromOutgoingContext¶added inv1.3.0
FromOutgoingContext returns the outgoing metadata in ctx if it exists.
All keys in the returned MD are lowercase.
funcJoin¶added inv1.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 mdscontaining those values are presented to Join.
funcNew¶
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.
Keys beginning with "grpc-" are reserved for grpc-internal use only and mayresult in errors if set in metadata.
funcPairs¶
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.
Keys beginning with "grpc-" are reserved for grpc-internal use only and mayresult in errors if set in metadata.
func (MD)Append¶added inv1.12.0
Append adds the values to key k, not overwriting what was already stored atthat key.
k is converted to lowercase before storing in md.
func (MD)Delete¶added inv1.40.0
Delete removes the values for a given key k which is converted to lowercasebefore removing it from md.