metadata

package
v0.0.0-...-3fe35c7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestID string = "requestId"
	AccountID string = "accountId"
	UserID    string = "userId"
	TraceID   string = "zipkinTraceId"
)

Variables

This section is empty.

Functions

func GetAccountID

func GetAccountID(ctx context.Context) string

GetAccountID tries to extract the accountId key from the given context. If no AccountID exists, an empty string is returned.

func GetMetadata

func GetMetadata(ctx context.Context) (metadata.MD, bool)

GetMetadata is a convenience function which can be used in order to not have to import two metadata libraries (grpc/metadata and go-godin/metadata)

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID tries to extract the requestId key from the given context.

func GetUserID

func GetUserID(ctx context.Context) string

GetUserID tries to extract the userId key from the given context. If no UserID exists, an empty string is returned

func Has

func Has(ctx context.Context, key string) bool

Has checks whether the passed key exists in the context metadata

func HasAccountID

func HasAccountID(ctx context.Context) bool

func HasUserID

func HasUserID(ctx context.Context) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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