Documentation
¶
Overview ¶
Package context provides a context for accessing services
Package metadata is a way of defining message headers
Index ¶
- Variables
- func Delete(ctx context.Context, k string) context.Context
- func Get(ctx context.Context, key string) (string, bool)
- func GetMetadata(ctx context.Context, k string) (string, bool)
- func MergeContext(ctx context.Context, patchMd Metadata, overwrite bool) context.Context
- func NewContext(ctx context.Context, md Metadata) context.Context
- func Set(ctx context.Context, k, v string) context.Context
- func SetMetadata(ctx context.Context, k, v string) context.Context
- func SetNamespace(ctx context.Context, ns string) context.Context
- func WithNamespace(ns string) context.Context
- type Metadata
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultContext is a context which can be used to access micro services DefaultContext = WithNamespace("micro") NamespaceKey = "Micro-Namespace" )
Functions ¶
func GetMetadata ¶
GetMetadata returns metadata from the context
func MergeContext ¶
MergeContext merges metadata to existing metadata, overwriting if specified
func NewContext ¶
NewContext creates a new context with the given metadata
func SetMetadata ¶
SetMetadata sets the metadata within the context
func SetNamespace ¶
SetNamespace sets the namespace for a context
func WithNamespace ¶
WithNamespace creates a new context with the given namespace
Types ¶
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
Click to show internal directories.
Click to hide internal directories.