Documentation ¶
Index ¶
- Constants
- func AppendToHeaderContext(ctx context.Context, kv Header) context.Context
- func NewHeaderContext(ctx context.Context, header Header) context.Context
- func NewParentIDContext(ctx context.Context, id ParentID) context.Context
- func NewParentTimestampContext(ctx context.Context, timestamp ParentTimestamp) context.Context
- func NewRetriesContext(ctx context.Context, retries Header) context.Context
- type CtxKey
- type Header
- type HeaderValue
- type Key
- type ParentID
- type ParentTimestamp
- type Retries
Constants ¶
const ( CtxHeader = CtxKey("header") CtxRetries = CtxKey("retries") CtxOrigin = CtxKey("origin") CtxParentTimestamp = CtxKey("parent-timestamp") CtxParentID = CtxKey("parent-id") )
Available context key types
const (
// HeaderValueDevider represents the UTF-8 value that is used to devide values
HeaderValueDevider = ";"
)
Variables ¶
This section is empty.
Functions ¶
func AppendToHeaderContext ¶
AppendToHeaderContext returns a new context with the provided Header merged with any existing metadata in the context.
func NewHeaderContext ¶
NewHeaderContext creates a new context with Header attached. If used in conjunction with AppendToHeaderContext, NewHeaderContext will overwrite any previously-appended types.
func NewParentIDContext ¶
NewParentIDContext creates a new context with ParentID attached. If used NewParentIDContext will overwrite any previously-appended
func NewParentTimestampContext ¶
func NewParentTimestampContext(ctx context.Context, timestamp ParentTimestamp) context.Context
NewParentTimestampContext creates a new context with ParentTimestamp attached. If used NewParentTimestampContext will overwrite any previously-appended
Types ¶
type Header ¶
type Header map[string]HeaderValue
Header is a mapping from metadata keys to values.
func HeaderFromContext ¶
HeaderFromContext returns the Header in ctx if it exists. The returned Header should not be modified. Writing to it may cause races. Modification should be made to copies of the returned Header.
type HeaderValue ¶
type HeaderValue []string
HeaderValue a slice of header values
func (HeaderValue) String ¶
func (h HeaderValue) String() string
String returns the header values seperated by a ";"
type ParentTimestamp ¶
ParentTimestamp parent message creation time
func ParentTimestampFromContext ¶
func ParentTimestampFromContext(ctx context.Context) (timestamp ParentTimestamp, ok bool)
ParentTimestampFromContext returns the ParentTimestamp in ctx if it exists. The returned ParentTimestamp should not be modified. Writing to it may cause races. Modification should be made to copies of the returned Header.