package metadata
import "google.golang.org/grpc/metadata"
Package metadata define the structure of the metadata supported by gRPC library. Please refer to http://www.grpc.io/docs/guides/wire.html for more information about custom-metadata.
Index ¶
- func DecodeKeyValue(k, v string) (string, string, error)
- func NewContext(ctx context.Context, md MD) context.Context
- func NewIncomingContext(ctx context.Context, md MD) context.Context
- func NewOutgoingContext(ctx context.Context, md MD) context.Context
- type MD
- func FromContext(ctx context.Context) (md MD, ok bool)
- func FromIncomingContext(ctx context.Context) (md MD, ok bool)
- func FromOutgoingContext(ctx context.Context) (md MD, ok bool)
- func Join(mds ...MD) MD
- func New(m map[string]string) MD
- func Pairs(kv ...string) MD
- func (md MD) Copy() MD
- func (md MD) Len() int
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 ¶
NewIncomingContext creates a new context with incoming md attached.
func NewOutgoingContext ¶
NewOutgoingContext creates a new context with outgoing 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 ¶
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 ¶
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 ¶
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. Keys 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. Keys are automatically converted to lowercase.
func (MD) Copy ¶
Copy returns a copy of md.
func (MD) Len ¶
Len returns the number of items in md.
Source Files ¶
metadata.go
- Version
- v1.4.1
- Published
- Jun 14, 2017
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 1 hour ago –
Tools for package owners.