metadata

package
v1.0.1-GA Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2016 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package metadata define the structure of the metadata supported by gRPC library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeKeyValue

func DecodeKeyValue(k, v string) (string, string, error)

DecodeKeyValue returns the original key and value corresponding to the encoded data in k, v. If k is a binary header and v contains comma, v is split on comma before decoded, and the decoded v will be joined with comma before returned.

func NewContext

func NewContext(ctx context.Context, md MD) context.Context

NewContext creates a new context with md attached.

Types

type 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.

func FromContext

func FromContext(ctx context.Context) (md MD, ok bool)

FromContext returns the MD in ctx if it exists.

func New

func New(m map[string]string) MD

New creates a MD from given key-value map.

func Pairs

func Pairs(kv ...string) MD

Pairs returns an MD formed by the mapping of key, value ... Pairs panics if len(kv) is odd.

func (MD) Copy

func (md MD) Copy() MD

Copy returns a copy of md.

func (MD) Len

func (md MD) Len() int

Len returns the number of items in md.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL