Documentation
¶
Overview ¶
Package metadata contains metadata storage used across buypal application.
Package xmeta contains helper functions and keys to use with grpc metadata.
Index ¶
- Constants
- func AcceptLanguage(md metadata.MD) (language.Tag, bool)
- func AcceptLanguages(md metadata.MD) ([]language.Tag, bool)
- func Authorization(md metadata.MD) (string, bool)
- func ContentLanguage(md metadata.MD) (language.Tag, bool)
- func Currency(md metadata.MD) (currency.Unit, bool)
- func RemoteIP(md metadata.MD) (string, bool)
- func RequestID(md metadata.MD) (string, bool)
- func SetAcceptLanguages(md metadata.MD, tags []language.Tag)
- func SetAuthorization(md metadata.MD, auth string)
- func SetContentLanguage(md metadata.MD, tag language.Tag)
- func SetCurrency(md metadata.MD, c currency.Unit)
- func SetRemoteIP(md metadata.MD, remoteIP net.IP)
- func SetRequestID(md metadata.MD, requestID string)
- func SetUserID(md metadata.MD, userID string)
- func UserID(md metadata.MD) (string, bool)
Constants ¶
const ( KeyAuthorization = "authorization" KeyContentLanguage = "content_language" KeyAcceptLanguages = "accept_language" KeyCurrency = "currency" KeyUserID = "user_id" KeyRemoteIP = "remote_ip" KeyRequestID = "request_id" )
Constant metadata key definitions.
Variables ¶
This section is empty.
Functions ¶
func AcceptLanguage ¶
AcceptLanguage gets the first accepted language stored in the context metadata.
func AcceptLanguages ¶
AcceptLanguages gets the accepted languages stored in the context metadata.
func Authorization ¶
Authorization gets metadata token.
func ContentLanguage ¶
ContentLanguage gets the content language from the context metadata.
func SetAcceptLanguages ¶
SetAcceptLanguages sets up accept languages in the metadata.
func SetAuthorization ¶
SetAuthorization sets the token in the metadata context.
func SetContentLanguage ¶
SetContentLanguage sets the content language in the context.
func SetCurrency ¶
SetCurrency sets up given currency in the metadata.
func SetRemoteIP ¶
SetRemoteIP sets the remoteIP in the metadata.
func SetRequestID ¶
SetRequestID sets the request id in the metadata.
Types ¶
This section is empty.