metadata
v0.0.0-20150305034656-fa9ecddd2c59
github.com/adg/grpc-go/metadata
Documentation
pkg.go.dev ↗Package metadata define the structure of the metadata supported by gRPC library.
Functions
DecodeKeyValue
func DecodeKeyValue(k, v string) (string, string, error)
DecodeKeyValue returns the original key and value corresponding to the encoded data in k, v.
NewContext
func NewContext(ctx context.Context, md MD) context.Context
NewContext creates a new context with md attached.
Types
MD
type MD map[string]string
MD is a mapping from metadata keys to values. Users should use the following two convenience functions New and Pairs to generate MD.
FromContext
func FromContext(ctx context.Context) (md MD, ok bool)
FromContext returns the MD in ctx if it exists.
New
func New(m map[string]string) MD
New creates a MD from given key-value map.
Pairs
func Pairs(kv ...string) MD
Pairs returns an MD formed by the mapping of key, value ... Pairs panics if len(kv) is odd.
MD.Copy
func (md MD) Copy() MD
Copy returns a copy of md.
MD.Len
func (md MD) Len() int
Len returns the number of items in md.