context

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "aapi-"

Variables

This section is empty.

Functions

func IfEquals added in v0.17.0

func IfEquals[T comparable](ctx context.Context, key Key, expected T, fn func())

IfEquals executes the function if the key is set in the context as a string and the value is equal to the expected value

func IfSet

func IfSet[T any](ctx context.Context, key Key, fn func(value T))

IfSetAsString executes the function if the key is set in the context as a string

Types

type Key

type Key string

Key is the type of the keys used in the context

const (
	// KeyIsProvider is the name of the provider this data is coming from.
	// When coming from a generated client, it is `asyncapi`
	KeyIsProvider Key = Prefix + "provider"
	// KeyIsChannel is the name of the channel this data is coming from.
	KeyIsChannel Key = Prefix + "channel"
	// KeyIsMessageDirection is the direction this data is coming from.
	// It can be either "publication" or "reception"
	KeyIsMessageDirection Key = Prefix + "operation"
	// KeyIsMessage is the message that has been sent or received
	KeyIsMessage Key = Prefix + "message"
	// KeyIsCorrelationID is the correlation ID of the message
	KeyIsCorrelationID Key = Prefix + "correlationID"
)

func (Key) String added in v0.17.0

func (k Key) String() string

String returns the string representation of the key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL