Documentation ¶
Overview ¶
Package metadata is a way of defining message headers
Package metadata is a way of defining message headers
Index ¶
- Variables
- func AppendIncomingContext(ctx context.Context, kv ...string) context.Context
- func AppendOutgoingContext(ctx context.Context, kv ...string) context.Context
- func NewContext(ctx context.Context, md Metadata) context.Context
- func NewIncomingContext(ctx context.Context, md Metadata) context.Context
- func NewOutgoingContext(ctx context.Context, md Metadata) context.Context
- func SetIncomingContext(ctx context.Context, md Metadata) bool
- func SetOutgoingContext(ctx context.Context, md Metadata) bool
- type Iterator
- type Metadata
- func Copy(md Metadata, exclude ...string) Metadata
- func FromContext(ctx context.Context) (Metadata, bool)
- func FromIncomingContext(ctx context.Context) (Metadata, bool)
- func FromOutgoingContext(ctx context.Context) (Metadata, bool)
- func Merge(omd Metadata, mmd Metadata, overwrite bool) Metadata
- func New(size int) Metadata
- func Pairs(kv ...string) (Metadata, bool)
Constants ¶
This section is empty.
Variables ¶
var ( // HeaderTopic is the header name that contains topic name HeaderTopic = "Micro-Topic" // HeaderContentType specifies content type of message HeaderContentType = "Content-Type" // HeaderEndpoint specifies endpoint in service HeaderEndpoint = "Micro-Endpoint" // HeaderService specifies service HeaderService = "Micro-Service" // HeaderTimeout specifies timeout of operation HeaderTimeout = "Micro-Timeout" // HeaderAuthorization specifies Authorization header HeaderAuthorization = "Authorization" // HeaderXRequestID specifies request id HeaderXRequestID = "X-Request-Id" )
Functions ¶
func AppendIncomingContext ¶
AppendIncomingContext apends new md to context
func AppendOutgoingContext ¶
AppendOutgoingContext apends new md to context
func NewContext ¶
NewContext creates a new context with the given metadata
func NewIncomingContext ¶
NewIncomingContext creates a new context with incoming metadata attached
func NewOutgoingContext ¶
NewOutgoingContext creates a new context with outcoming metadata attached
func SetIncomingContext ¶
SetIncomingContext modify incoming context with given metadata
Types ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator used to iterate over metadata with order
type Metadata ¶
Metadata is our way of representing request headers internally. They're used at the RPC level and translate back and forth from Transport headers.
func FromContext ¶
FromContext returns metadata from the given context returned metadata shoud not be modified or race condition happens
func FromIncomingContext ¶
FromIncomingContext returns metadata from incoming ctx returned metadata shoud not be modified or race condition happens
func FromOutgoingContext ¶
FromOutgoingContext returns metadata from outgoing ctx returned metadata shoud not be modified or race condition happens