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 IncomingCtxAcceptLanguages(ctx context.Context) ([]language.Tag, bool)
- func IncomingCtxAuthorization(ctx context.Context) (string, bool)
- func IncomingCtxContentLanguage(ctx context.Context) (language.Tag, bool)
- func IncomingCtxCurrency(ctx context.Context) (currency.Unit, bool)
- func IncomingCtxRemoteIP(ctx context.Context) (string, bool)
- func IncomingCtxRequestID(ctx context.Context) (string, bool)
- func IncomingCtxSetAcceptLanguages(ctx context.Context, tags []language.Tag) context.Context
- func IncomingCtxSetAuthorization(ctx context.Context, auth string) context.Context
- func IncomingCtxSetContentLanguage(ctx context.Context, tag language.Tag) context.Context
- func IncomingCtxSetCurrency(ctx context.Context, c currency.Unit) context.Context
- func IncomingCtxSetRemoteIP(ctx context.Context, remoteIP net.IP) context.Context
- func IncomingCtxSetRequestID(ctx context.Context, requestID string) context.Context
- func IncomingCtxSetUserID(ctx context.Context, userID string) context.Context
- func IncomingCtxUserID(ctx context.Context) (string, 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 IncomingCtxAcceptLanguages ¶
IncomingCtxAcceptLanguages gets the AcceptLanguages from the incoming context.
func IncomingCtxAuthorization ¶
IncomingCtxAuthorization gets the Authorization from the incoming context.
func IncomingCtxContentLanguage ¶
IncomingCtxContentLanguage gets the ContentLanguage from the incoming context.
func IncomingCtxCurrency ¶
IncomingCtxCurrency gets the Currency from the incoming context.
func IncomingCtxRemoteIP ¶
IncomingCtxRemoteIP gets the RemoteIP from the incoming context.
func IncomingCtxRequestID ¶
IncomingCtxRequestID gets the RequestID from the incoming context.
func IncomingCtxSetAcceptLanguages ¶
IncomingCtxSetAcceptLanguages sets up AcceptLanguages in the incoming context metadata.
func IncomingCtxSetAuthorization ¶
IncomingCtxSetAuthorization sets up Authorization in the incoming context metadata.
func IncomingCtxSetContentLanguage ¶
IncomingCtxSetContentLanguage sets up ContentLanguage in the incoming context metadata.
func IncomingCtxSetCurrency ¶
IncomingCtxSetCurrency sets up Currency in the incoming context metadata.
func IncomingCtxSetRemoteIP ¶
IncomingCtxSetRemoteIP sets up RemoteIP in the incoming context metadata.
func IncomingCtxSetRequestID ¶
IncomingCtxSetRequestID sets up RequestID in the incoming context metadata.
func IncomingCtxSetUserID ¶
IncomingCtxSetUserID sets up UserID in the incoming context metadata.
func IncomingCtxUserID ¶
IncomingCtxUserID gets the UserID from the incoming context.
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.