Documentation
¶
Index ¶
- Constants
- func GetAcceptLanguage(ctx context.Context) language.Language
- func GetRequestID(ctx context.Context) string
- func GetRequestStartTime(ctx context.Context) time.Time
- func GetServiceVersion(ctx context.Context) string
- func GetUserAgent(ctx context.Context) string
- func SetAcceptLanguage(ctx context.Context, lang language.Language) context.Context
- func SetRequestID(ctx context.Context, id string) context.Context
- func SetRequestStartTime(ctx context.Context, rst time.Time) context.Context
- func SetServiceVersion(ctx context.Context, version string) context.Context
- func SetUserAgent(ctx context.Context, ua string) context.Context
Constants ¶
View Source
const ( AcceptLanguage contextKey = "AcceptLanguage" RequestID contextKey = "RequestID" ServiceVersion contextKey = "ServiceVersion" UserAgent contextKey = "UserAgent" RequestStartTime contextKey = "RequestStartTime" )
Variables ¶
This section is empty.
Functions ¶
func GetAcceptLanguage ¶
Get accept language from context and if not exists, this function will return `language.English` as default value
func GetRequestID ¶
Get request id from context and will return empty string if not exist
func GetRequestStartTime ¶
Get request start time from context will return zero value of `time.Time` if not exist
func GetServiceVersion ¶
Get service version from context and will return empty string if not exist
func GetUserAgent ¶
Get user agent from context and will return empty string if not exist
func SetAcceptLanguage ¶
Set accept language to context
func SetRequestID ¶
Set request id to context
func SetRequestStartTime ¶
Set request start time to context
func SetServiceVersion ¶
Set service version to context
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.