Documentation ¶
Index ¶
- func GetString(b []byte) string
- type 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) String() string
- func (m NiceMD) ToIncoming(ctx context.Context) context.Context
- func (m NiceMD) ToOutgoing(ctx context.Context) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NiceMD ¶ added in v0.1.0
NiceMD is a convenience wrapper defining extra functions on the metadata.
func ExtractIncoming ¶ added in v0.1.0
ExtractIncoming 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 ¶ added in v0.1.0
ExtractOutgoing 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 (NiceMD) Add ¶ added in v0.1.0
Add 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 (NiceMD) Clone ¶ added in v0.1.0
Clone 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 (NiceMD) Get ¶ added in v0.1.0
Get 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 (NiceMD) Set ¶ added in v0.1.0
Set 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 ¶ added in v0.1.0
ToIncoming sets the given NiceMD as a server-side context for dispatching.
This is mostly useful in ServerInterceptors..