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
- 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
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
Types ¶
type Metadata ¶
Metadata is our way of representing request headers internally.
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