grpc

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcClient

type GrpcClient struct {
	Ctx         context.Context
	Connection  *grpc.ClientConn
	CallTimeout time.Duration
}

func NewGrpcClient

func NewGrpcClient(endpoint string, callTimeout time.Duration, unary ...grpc.UnaryClientInterceptor) (*GrpcClient, error)

NewGrpcClient 创建 gRPC 客户端

type Option

type Option func(*Options)

func WithAddrOption

func WithAddrOption(s string) Option

func WithContextOption

func WithContextOption(c context.Context) Option

func WithDomainOption

func WithDomainOption(s string) Option

func WithIDOption

func WithIDOption(s string) Option

func WithKeepAliveOption

func WithKeepAliveOption(t time.Duration) Option

func WithMaxConcurrentStreamsOption

func WithMaxConcurrentStreamsOption(i int) Option

func WithMaxConnectionAgeGraceOption

func WithMaxConnectionAgeGraceOption(t time.Duration) Option

func WithMaxConnectionAgeOption

func WithMaxConnectionAgeOption(t time.Duration) Option

func WithMaxMsgSizeOption

func WithMaxMsgSizeOption(i int) Option

func WithStreamServerInterceptorsOption

func WithStreamServerInterceptorsOption(u ...grpc.StreamServerInterceptor) Option

func WithTimeoutOption

func WithTimeoutOption(t time.Duration) Option

func WithTlsOption

func WithTlsOption(tls *tls.Config) Option

func WithUnaryServerInterceptorsOption

func WithUnaryServerInterceptorsOption(u ...grpc.UnaryServerInterceptor) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(name string, options ...Option) *Server

New new grpc server

func (*Server) Attempt

func (e *Server) Attempt() bool

func (*Server) NewServer

func (e *Server) NewServer()

func (*Server) Options

func (e *Server) Options(options ...Option)

func (*Server) Register

func (e *Server) Register(do func(server *Server))

func (*Server) Server

func (e *Server) Server() *grpc.Server

func (*Server) Shutdown

func (e *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (e *Server) Start(ctx context.Context) error

func (*Server) String

func (e *Server) String() string

String string

Directories

Path Synopsis
interceptors

Jump to

Keyboard shortcuts

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