import "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils"
- type NiceMD
- func ExtractIncoming(ctx context.Context) NiceMD
- func ExtractOutgoing(ctx context.Context) NiceMD
- func (m NiceMD) Add(key string, value string) NiceMD
- func (m NiceMD) Clone(copiedKeys ...string) NiceMD
- func (m NiceMD) Del(key string) NiceMD
- func (m NiceMD) Get(key string) string
- func (m NiceMD) Set(key string, value string) NiceMD
- func (m NiceMD) ToIncoming(ctx context.Context) context.Context
- func (m NiceMD) ToOutgoing(ctx context.Context) context.Context
doc.go nicemd.go single_key.go
type NiceMD metadata.MDNiceMD is a convenience wrapper definiting extra functions on the metadata.
func ExtractIncoming(ctx context.Context) NiceMDExtractIncoming extracts an inbound metadata from the server-side context.
This function always returns a NiceMD wrapper of the metadata.MD, in case the context doesn't have metadata it returns a new empty NiceMD.
func ExtractOutgoing(ctx context.Context) NiceMDExtractOutgoing extracts an outbound metadata from the client-side context.
This function always returns a NiceMD wrapper of the metadata.MD, in case the context doesn't have metadata it returns a new empty NiceMD.
func (m NiceMD) Add(key string, value string) NiceMDAdd retrieves a single value from the metadata.
It works analogously to http.Header.Add, as it appends to any existing values associated with key.
The function is binary-key safe.
func (m NiceMD) Clone(copiedKeys ...string) NiceMDClone performs a deep copy of the metadata.MD.
You can specify the lower-case copiedKeys to only copy certain whitelisted keys. If no keys are explicitly whitelisted all keys get copied.
func (m NiceMD) Del(key string) NiceMDfunc (m NiceMD) Get(key string) stringGet retrieves a single value from the metadata.
It works analogously to http.Header.Get, returning the first value if there are many set. If the value is not set, an empty string is returned.
The function is binary-key safe.
func (m NiceMD) Set(key string, value string) NiceMDSet sets the given value in a metadata.
It works analogously to http.Header.Set, overwriting all previous metadata values.
The function is binary-key safe.
func (NiceMD) ToIncoming
func (m NiceMD) ToIncoming(ctx context.Context) context.ContextToIncoming sets the given NiceMD as a server-side context for dispatching.
This is mostly useful in ServerInterceptors..
func (NiceMD) ToOutgoing
func (m NiceMD) ToOutgoing(ctx context.Context) context.ContextToOutgoing sets the given NiceMD as a client-side context for dispatching.
Generated by godoc2ghmd