Documentation ¶
Index ¶
- Variables
- func IDFromIncomingContext(ctx context.Context) (string, error)
- func IDFromMetadata(md metadata.MD) (string, error)
- func KeyFromIncomingContext(ctx context.Context) (string, error)
- func KeyFromMetadata(md metadata.MD) (string, error)
- func LimitAndOffsetFromIncomingContext(ctx context.Context) (limit, offset uint64, err error)
- func LimitFromMetadata(md metadata.MD) (uint64, error)
- func MetadataFromIncomingContext(ctx context.Context) metadata.MD
- func MetadataFromOutgoingContext(ctx context.Context) metadata.MD
- func OffsetFromMetadata(md metadata.MD) (uint64, error)
- func OutgoingContextWithID(ctx context.Context, id string) context.Context
- func OutgoingContextWithKey(ctx context.Context, key string) context.Context
- func OutgoingContextWithLimitAndOffset(ctx context.Context, limit, offset uint64) context.Context
- func OutgoingContextWithServiceInfo(ctx context.Context, serviceName, serviceVersion, netAddress string) context.Context
- func OutgoingContextWithToken(ctx context.Context, token string) context.Context
- func ServiceInfoFromIncomingContext(ctx context.Context) (serviceName, serviceVersion, netAddress string, err error)
- func ServiceInfoFromMetadata(md metadata.MD) (serviceName, serviceVersion, netAddress string, err error)
- func TokenFromIncomingContext(ctx context.Context) (string, error)
- func TokenFromMetadata(md metadata.MD) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoToken = errors.New("context: Metadata does not contain token") ErrNoKey = errors.New("context: Metadata does not contain key") ErrNoID = errors.New("context: Metadata does not contain id") )
Errors that are returned when an item could not be retrieved TODO: use go-utils/errors when ready
Functions ¶
func IDFromIncomingContext ¶
IDFromIncomingContext gets the key from the incoming context or returns ErrNoID
func IDFromMetadata ¶
IDFromMetadata gets the key from the metadata or returns ErrNoID
func KeyFromIncomingContext ¶
KeyFromIncomingContext gets the key from the incoming context or returns ErrNoKey
func KeyFromMetadata ¶
KeyFromMetadata gets the key from the metadata or returns ErrNoKey
func LimitAndOffsetFromIncomingContext ¶
LimitAndOffsetFromIncomingContext gets the limit and offset from the incoming context
func LimitFromMetadata ¶
LimitFromMetadata gets the limit from the metadata
func MetadataFromIncomingContext ¶
MetadataFromIncomingContext gets the metadata from the given context
func MetadataFromOutgoingContext ¶
MetadataFromOutgoingContext gets the metadata from the given context
func OffsetFromMetadata ¶
OffsetFromMetadata gets the offset from the metadata
func OutgoingContextWithID ¶
OutgoingContextWithID returns an outgoing context with the id
func OutgoingContextWithKey ¶
OutgoingContextWithKey returns an outgoing context with the key
func OutgoingContextWithLimitAndOffset ¶
OutgoingContextWithLimitAndOffset returns an outgoing context with the limit and offset
func OutgoingContextWithServiceInfo ¶
func OutgoingContextWithServiceInfo(ctx context.Context, serviceName, serviceVersion, netAddress string) context.Context
OutgoingContextWithServiceInfo returns an outgoing context with the id
func OutgoingContextWithToken ¶
OutgoingContextWithToken returns an outgoing context with the token
func ServiceInfoFromIncomingContext ¶
func ServiceInfoFromIncomingContext(ctx context.Context) (serviceName, serviceVersion, netAddress string, err error)
ServiceInfoFromIncomingContext gets the service information from the incoming context or returns empty strings
func ServiceInfoFromMetadata ¶
func ServiceInfoFromMetadata(md metadata.MD) (serviceName, serviceVersion, netAddress string, err error)
ServiceInfoFromMetadata gets the service information from the metadata or returns empty strings
func TokenFromIncomingContext ¶
TokenFromIncomingContext gets the token from the incoming context or returns ErrNoToken
Types ¶
This section is empty.