Documentation ¶
Index ¶
- func Get[T any](ctx context.Context, key Key) T
- func GetLogErrHook(ctx context.Context) func(error)
- func GetRequestID(ctx context.Context) string
- func Set[T any](ctx context.Context, key Key, value T) context.Context
- func SetLogErrHook(ctx context.Context, hook func(err error)) context.Context
- func SetRequestID(ctx context.Context, id string) context.Context
- type Key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get gets value of type T from context. If valued does not exist returns zeroed value for type T.
func GetLogErrHook ¶
GetLogErrHook gets the hook function from the context which sets the error to server error log. If searched values is absent in context, then nil wil be returned.
func GetRequestID ¶
GetRequestID gets the request ID from the context. If searched values is absent in context, then empty string wil be returned.
func SetLogErrHook ¶
SetLogErrHook sets the hook function to the context.
Types ¶
Click to show internal directories.
Click to hide internal directories.