xmeta

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

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

View Source
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

func AcceptLanguage(md metadata.MD) (language.Tag, bool)

AcceptLanguage gets the first accepted language stored in the context metadata.

func AcceptLanguages

func AcceptLanguages(md metadata.MD) ([]language.Tag, bool)

AcceptLanguages gets the accepted languages stored in the context metadata.

func Authorization

func Authorization(md metadata.MD) (string, bool)

Authorization gets metadata token.

func ContentLanguage

func ContentLanguage(md metadata.MD) (language.Tag, bool)

ContentLanguage gets the content language from the context metadata.

func Currency

func Currency(md metadata.MD) (currency.Unit, bool)

Currency gets the metadata currency.

func IncomingCtxAcceptLanguages

func IncomingCtxAcceptLanguages(ctx context.Context) ([]language.Tag, bool)

IncomingCtxAcceptLanguages gets the AcceptLanguages from the incoming context.

func IncomingCtxAuthorization

func IncomingCtxAuthorization(ctx context.Context) (string, bool)

IncomingCtxAuthorization gets the Authorization from the incoming context.

func IncomingCtxContentLanguage

func IncomingCtxContentLanguage(ctx context.Context) (language.Tag, bool)

IncomingCtxContentLanguage gets the ContentLanguage from the incoming context.

func IncomingCtxCurrency

func IncomingCtxCurrency(ctx context.Context) (currency.Unit, bool)

IncomingCtxCurrency gets the Currency from the incoming context.

func IncomingCtxRemoteIP

func IncomingCtxRemoteIP(ctx context.Context) (string, bool)

IncomingCtxRemoteIP gets the RemoteIP from the incoming context.

func IncomingCtxRequestID

func IncomingCtxRequestID(ctx context.Context) (string, bool)

IncomingCtxRequestID gets the RequestID from the incoming context.

func IncomingCtxSetAcceptLanguages

func IncomingCtxSetAcceptLanguages(ctx context.Context, tags []language.Tag) context.Context

IncomingCtxSetAcceptLanguages sets up AcceptLanguages in the incoming context metadata.

func IncomingCtxSetAuthorization

func IncomingCtxSetAuthorization(ctx context.Context, auth string) context.Context

IncomingCtxSetAuthorization sets up Authorization in the incoming context metadata.

func IncomingCtxSetContentLanguage

func IncomingCtxSetContentLanguage(ctx context.Context, tag language.Tag) context.Context

IncomingCtxSetContentLanguage sets up ContentLanguage in the incoming context metadata.

func IncomingCtxSetCurrency

func IncomingCtxSetCurrency(ctx context.Context, c currency.Unit) context.Context

IncomingCtxSetCurrency sets up Currency in the incoming context metadata.

func IncomingCtxSetRemoteIP

func IncomingCtxSetRemoteIP(ctx context.Context, remoteIP net.IP) context.Context

IncomingCtxSetRemoteIP sets up RemoteIP in the incoming context metadata.

func IncomingCtxSetRequestID

func IncomingCtxSetRequestID(ctx context.Context, requestID string) context.Context

IncomingCtxSetRequestID sets up RequestID in the incoming context metadata.

func IncomingCtxSetUserID

func IncomingCtxSetUserID(ctx context.Context, userID string) context.Context

IncomingCtxSetUserID sets up UserID in the incoming context metadata.

func IncomingCtxUserID

func IncomingCtxUserID(ctx context.Context) (string, bool)

IncomingCtxUserID gets the UserID from the incoming context.

func RemoteIP

func RemoteIP(md metadata.MD) (string, bool)

RemoteIP gets metadata remote ip.

func RequestID

func RequestID(md metadata.MD) (string, bool)

RequestID gets the request identifier.

func SetAcceptLanguages

func SetAcceptLanguages(md metadata.MD, tags []language.Tag)

SetAcceptLanguages sets up accept languages in the metadata.

func SetAuthorization

func SetAuthorization(md metadata.MD, auth string)

SetAuthorization sets the token in the metadata context.

func SetContentLanguage

func SetContentLanguage(md metadata.MD, tag language.Tag)

SetContentLanguage sets the content language in the context.

func SetCurrency

func SetCurrency(md metadata.MD, c currency.Unit)

SetCurrency sets up given currency in the metadata.

func SetRemoteIP

func SetRemoteIP(md metadata.MD, remoteIP net.IP)

SetRemoteIP sets the remoteIP in the metadata.

func SetRequestID

func SetRequestID(md metadata.MD, requestID string)

SetRequestID sets the request id in the metadata.

func SetUserID

func SetUserID(md metadata.MD, userID string)

SetUserID sets up user id in the metadata.

func UserID

func UserID(md metadata.MD) (string, bool)

UserID gets the user id from the metadata.

Types

This section is empty.

Jump to

Keyboard shortcuts

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