Documentation
¶
Index ¶
- type GrpcContext
- func (gc *GrpcContext) GenerateHash() string
- func (gc *GrpcContext) GetAttachment(key string) (any, bool)
- func (gc *GrpcContext) GetContext() context.Context
- func (gc *GrpcContext) GetRoute() *model.RouteAction
- func (gc *GrpcContext) GetStream() model.RPCStream
- func (gc *GrpcContext) IsBidirectionalStreaming() bool
- func (gc *GrpcContext) IsClientStreaming() bool
- func (gc *GrpcContext) IsServerStreaming() bool
- func (gc *GrpcContext) IsUnary() bool
- func (gc *GrpcContext) SetAttachment(key string, value any)
- func (gc *GrpcContext) SetContext(ctx context.Context)
- func (gc *GrpcContext) SetError(err error)
- func (gc *GrpcContext) SetResult(result any)
- func (gc *GrpcContext) SetRoute(route *model.RouteAction)
- func (gc *GrpcContext) SetStream(stream model.RPCStream)
- type StreamType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GrpcContext ¶
type GrpcContext struct {
Context context.Context
MethodName string
ServiceName string
Arguments []any
Attachments map[string]any
Route *model.RouteAction
Result any
Error error
StreamType StreamType
Stream model.RPCStream
}
GrpcContext gRPC request context, similar to dubbo.RpcContext
func (*GrpcContext) GenerateHash ¶
func (gc *GrpcContext) GenerateHash() string
GenerateHash generate hash for cache key
func (*GrpcContext) GetAttachment ¶
func (gc *GrpcContext) GetAttachment(key string) (any, bool)
GetAttachment get attachment by key
func (*GrpcContext) GetContext ¶
func (gc *GrpcContext) GetContext() context.Context
GetContext get golang context
func (*GrpcContext) GetRoute ¶
func (gc *GrpcContext) GetRoute() *model.RouteAction
GetRoute get route
func (*GrpcContext) GetStream ¶
func (gc *GrpcContext) GetStream() model.RPCStream
GetStream gets the RPCStream for streaming operations
func (*GrpcContext) IsBidirectionalStreaming ¶
func (gc *GrpcContext) IsBidirectionalStreaming() bool
IsBidirectionalStreaming check if it's bidirectional streaming
func (*GrpcContext) IsClientStreaming ¶
func (gc *GrpcContext) IsClientStreaming() bool
IsClientStreaming check if it's client streaming
func (*GrpcContext) IsServerStreaming ¶
func (gc *GrpcContext) IsServerStreaming() bool
IsServerStreaming check if it's server streaming
func (*GrpcContext) IsUnary ¶
func (gc *GrpcContext) IsUnary() bool
IsUnary check if it's unary call
func (*GrpcContext) SetAttachment ¶
func (gc *GrpcContext) SetAttachment(key string, value any)
SetAttachment set attachment
func (*GrpcContext) SetContext ¶
func (gc *GrpcContext) SetContext(ctx context.Context)
SetContext set golang context
func (*GrpcContext) SetError ¶
func (gc *GrpcContext) SetError(err error)
SetError set error to context
func (*GrpcContext) SetResult ¶
func (gc *GrpcContext) SetResult(result any)
SetResult set result to context
func (*GrpcContext) SetRoute ¶
func (gc *GrpcContext) SetRoute(route *model.RouteAction)
SetRoute set route
func (*GrpcContext) SetStream ¶
func (gc *GrpcContext) SetStream(stream model.RPCStream)
SetStream sets the RPCStream for streaming operations
type StreamType ¶
type StreamType int
StreamType defines the type of gRPC stream
const ( UnaryCall StreamType = 0 + iota ClientStream ServerStream BidirectionalStream )