xmeta

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 4 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 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