Documentation
¶
Index ¶
- func ClientStubs(...) func(ctx context.Context, method string, req, reply interface{}, ...) error
- func ServerStubs(...) grpc.UnaryServerInterceptor
- type ClientConn
- type ClientOptional
- type ClientOptionals
- func (ClientOptionals) WithConf(conf config.Config) ClientOptional
- func (ClientOptionals) WithDialOptions(options ...grpc.DialOption) ClientOptional
- func (ClientOptionals) WithLogger(logger log.Logger) ClientOptional
- func (ClientOptionals) WithMetrics(metrics *ggp.ClientMetrics) ClientOptional
- func (ClientOptionals) WithTracer(tracer opentracing2.Tracer) ClientOptional
- type ClientOptions
- type ClientState
- type GrpcClient
- type GrpcServer
- type ServerOption
- type ServerOptions
- func (ServerOptions) WithGrpcServerOption(options ...grpc.ServerOption) ServerOption
- func (ServerOptions) WithServerConf(conf config.Config) ServerOption
- func (ServerOptions) WithServerLogger(logger log.Logger) ServerOption
- func (ServerOptions) WithTracer(tracer opentracing2.Tracer) ServerOption
- func (ServerOptions) WithUnarySrvItcp(options ...grpc.UnaryServerInterceptor) ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientStubs ¶
func ClientStubs(stubsFunc func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error) func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
func ServerStubs ¶
func ServerStubs(stubsFunc func( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (resp interface{}, err error)) grpc.UnaryServerInterceptor
Types ¶
type ClientConn ¶
type ClientConn struct {
// contains filtered or unexported fields
}
Collect the grpc.ClientConn instances
func NewClientConn ¶
func NewClientConn(logger log.Logger) *ClientConn
func (*ClientConn) Close ¶
func (this *ClientConn) Close()
Close unity closes the grpc.ClientConn instances
func (*ClientConn) CollectConn ¶
func (this *ClientConn) CollectConn(conn *grpc.ClientConn)
Examples:
client := grpc.NewClient(clientOptions) ctx := context.Background() conn := client.DialContext(ctx, ":50051") clientConn := NewClientConn() clientConn.CollectConn(conn)
func (*ClientConn) State ¶
func (this *ClientConn) State() []string
State unity show the grpc.ClientConn state
type ClientOptional ¶
type ClientOptional func(c *ClientOptions)
type ClientOptionals ¶
type ClientOptionals struct{}
func (ClientOptionals) WithConf ¶
func (ClientOptionals) WithConf(conf config.Config) ClientOptional
func (ClientOptionals) WithDialOptions ¶
func (ClientOptionals) WithDialOptions(options ...grpc.DialOption) ClientOptional
func (ClientOptionals) WithLogger ¶
func (ClientOptionals) WithLogger(logger log.Logger) ClientOptional
func (ClientOptionals) WithMetrics ¶
func (ClientOptionals) WithMetrics(metrics *ggp.ClientMetrics) ClientOptional
func (ClientOptionals) WithTracer ¶
func (ClientOptionals) WithTracer(tracer opentracing2.Tracer) ClientOptional
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
func NewClientOptions ¶
func NewClientOptions(options ...ClientOptional) *ClientOptions
type ClientState ¶
type ClientState struct {
// contains filtered or unexported fields
}
type GrpcClient ¶
type GrpcClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(clientOptions *ClientOptions) *GrpcClient
NewGrpcClient create GrpcClient for business. clientOptions clientOptions can not nil
func (*GrpcClient) Close ¶
func (this *GrpcClient) Close()
func (*GrpcClient) DialContext ¶
func (this *GrpcClient) DialContext(ctx context.Context, target string) *grpc.ClientConn
type GrpcServer ¶
func NewGrpcServer ¶
func NewGrpcServer(target string, options ...ServerOption) *GrpcServer
func (*GrpcServer) GracefulShutDown ¶
func (this *GrpcServer) GracefulShutDown()
func (*GrpcServer) Start ¶
func (this *GrpcServer) Start()
type ServerOption ¶
type ServerOption func(c *GrpcServer)
type ServerOptions ¶
type ServerOptions struct{}
func (ServerOptions) WithGrpcServerOption ¶
func (ServerOptions) WithGrpcServerOption(options ...grpc.ServerOption) ServerOption
func (ServerOptions) WithServerConf ¶
func (ServerOptions) WithServerConf(conf config.Config) ServerOption
func (ServerOptions) WithServerLogger ¶
func (ServerOptions) WithServerLogger(logger log.Logger) ServerOption
func (ServerOptions) WithTracer ¶
func (ServerOptions) WithTracer(tracer opentracing2.Tracer) ServerOption
func (ServerOptions) WithUnarySrvItcp ¶
func (ServerOptions) WithUnarySrvItcp(options ...grpc.UnaryServerInterceptor) ServerOption
Click to show internal directories.
Click to hide internal directories.