Documentation ¶
Index ¶
- func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func InitBuilder()
- type ClientOption
- func WithBalancerName(name string) ClientOption
- func WithClientLogger(logger log.Logger) ClientOption
- func WithClientOptions(opts ...grpc.DialOption) ClientOption
- func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) ClientOption
- func WithClientTimeout(timeout time.Duration) ClientOption
- func WithClientTracing() ClientOption
- func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
- func WithDiscovery(d registry.Discovery) ClientOption
- func WithEndpoint(endpoint string) ClientOption
- type Server
- type ServerOption
- func WithAddress(address string) ServerOption
- func WithEnableMetric(enable bool) ServerOption
- func WithLis(lis net.Listener) ServerOption
- func WithOptions(opts ...grpc.ServerOption) ServerOption
- func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func WithTimeout(timeout time.Duration) ServerOption
- func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
- type Trailer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
func DialInsecure ¶
func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
DialInsecure 非安全拨号
func InitBuilder ¶
func InitBuilder()
InitBuilder initializes the builder for the selector balancer. 初始化 grpc balancer
Types ¶
type ClientOption ¶
type ClientOption func(o *clientOptions)
func WithClientOptions ¶
func WithClientOptions(opts ...grpc.DialOption) ClientOption
WithClientOptions 设置grpc的dial选项
func WithClientStreamInterceptor ¶
func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) ClientOption
WithClientStreamInterceptor 设置stream拦截器
func WithClientTimeout ¶
func WithClientTimeout(timeout time.Duration) ClientOption
WithClientTimeout 设置超时时间
func WithClientUnaryInterceptor ¶
func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
WithClientUnaryInterceptor 设置拦截器
type Server ¶
type Server struct { // 匿名字段,用于实现 grpc 注册 Server *grpc.Server // contains filtered or unexported fields }
Server grpc 服务端结构体
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
type ServerOption ¶
type ServerOption func(o *Server)
func WithAddress ¶
func WithAddress(address string) ServerOption
func WithEnableMetric ¶
func WithEnableMetric(enable bool) ServerOption
func WithLis ¶
func WithLis(lis net.Listener) ServerOption
func WithOptions ¶
func WithOptions(opts ...grpc.ServerOption) ServerOption
func WithStreamInterceptor ¶
func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ServerOption
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
Click to show internal directories.
Click to hide internal directories.