grpc

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL