Documentation
¶
Index ¶
- Constants
- func FromContext(ctx context.Context) string
- func Server(opts ...Option) middleware.Middleware
- func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor
- func WithRequestID(ctx context.Context, requestID string) context.Context
- type Option
Constants ¶
View Source
const MetadataKey = "X-Request-Id"
MetadataKey 是 gRPC 请求标识使用的 metadata 键。 gRPC 底层传输会将 metadata 键规范化为小写,但对外保持该名称不变。
Variables ¶
This section is empty.
Functions ¶
func Server ¶
func Server(opts ...Option) middleware.Middleware
Server 创建适用于 Kratos gRPC Server 的请求标识中间件。
func StreamServerInterceptor ¶
func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor
StreamServerInterceptor 创建提取 metadata 请求标识的流式服务端拦截器。
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor
UnaryServerInterceptor 创建提取 metadata 请求标识并写入上下文的一元服务端拦截器。
Types ¶
Click to show internal directories.
Click to hide internal directories.