Documentation ¶
Index ¶
- func AddSimpleReqIDToContext(ctx context.Context, reqID string) context.Context
- func ClientBaseUnaryInterceptor(from string) grpc.UnaryClientInterceptor
- func GenerateSimpleReqID() string
- func GetSimpleReqIDFromContext(ctx context.Context) string
- func GetSimpleReqIDFromMetaData(ctx context.Context) (string, context.Context)
- func MustGetSimpleReqIDFromContext(ctx context.Context) (context.Context, string)
- func MustGetSimpleReqIDFromMetaData(ctx context.Context) (string, context.Context)
- func ServerSimpleRequestIDUnaryInterceptor() ...
- type FromKeyType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSimpleReqIDToContext ¶
AddSimpleReqIDToContext adds the simple request ID to the context
func ClientBaseUnaryInterceptor ¶ added in v0.0.9
func ClientBaseUnaryInterceptor(from string) grpc.UnaryClientInterceptor
ClientBaseUnaryInterceptor add reqID to outgoing context from main context
func GenerateSimpleReqID ¶
func GenerateSimpleReqID() string
GenerateSimpleReqID generates a simple request ID
func GetSimpleReqIDFromContext ¶
GetSimpleReqIDFromContext returns the simple request ID from the context if no simple request ID is found, returns an empty string
func GetSimpleReqIDFromMetaData ¶ added in v0.0.9
GetSimpleReqIDFromMetaData returns the simple request ID from the metadata metadata is incoming metadata if req-id contains in metadata we will add it to context
func MustGetSimpleReqIDFromContext ¶
MustGetSimpleReqIDFromContext returns the simple request ID from the context if no simple request ID is found, generates a new one and returns it and adds it to the context if simple request ID is found, returns new ctx with the simple request ID
func MustGetSimpleReqIDFromMetaData ¶ added in v0.0.9
MustGetSimpleReqIDFromMetaData returns the simple request ID from the metadata metadata is incoming metadata if req-id not contains in metadata we will generate new one and add it to context
func ServerSimpleRequestIDUnaryInterceptor ¶
func ServerSimpleRequestIDUnaryInterceptor() func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
ServerSimpleRequestIDUnaryInterceptor returns a new unary server interceptor for simple request ID if reqID is not found in the context, generates a new one and adds it to the context
Types ¶
type FromKeyType ¶ added in v0.0.9
type FromKeyType string
var FromKey FromKeyType = "x-api-from"
FromKey is the key hold from service name