Documentation
¶
Index ¶
- func GetAccountID(ctx context.Context) string
- func GetMetadata(ctx context.Context) (metadata.MD, bool)
- func GetRequestID(ctx context.Context) string
- func GetUserID(ctx context.Context) string
- func Has(ctx context.Context, key MetadataContextKey) bool
- func HasAccountID(ctx context.Context) bool
- func HasUserID(ctx context.Context) bool
- type MetadataContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAccountID ¶
GetAccountID tries to extract the accountId key from the given context. If no AccountID exists, an empty string is returned.
func GetMetadata ¶
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 ¶
GetRequestID tries to extract the requestId key from the given context.
func GetUserID ¶
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 MetadataContextKey) bool
Has checks whether the passed key exists in the context metadata
func HasAccountID ¶
Types ¶
type MetadataContextKey ¶
type MetadataContextKey string
const ( RequestID MetadataContextKey = "requestId" AccountID MetadataContextKey = "accountId" UserID MetadataContextKey = "userId" )
Click to show internal directories.
Click to hide internal directories.