Documentation ¶
Index ¶
- type Client
- type ClientOptions
- type GenerateClientFunc
- type Option
- func WithClientBalancer(b registry.Balancer) Option
- func WithClientDialOption(opts ...grpc.DialOption) Option
- func WithClientDiscovery(d registry.Discovery) Option
- func WithClientEnableMetrics(enable bool) Option
- func WithClientEnableTracing(enable bool) Option
- func WithClientEndpoint(endpoint string) Option
- func WithClientInsecure(enable bool) Option
- func WithClientResolver(r registry.Resolver) Option
- func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) Option
- func WithClientTLSConfig(c *tls.Config) Option
- func WithClientTimeout(timeout time.Duration) Option
- func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) Option
- type Server
- type ServerOption
- func AddServerOption(opts ...grpc.ServerOption) ServerOption
- func AddServerUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
- func AddStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func WithAddress(address string) ServerOption
- func WithHealthCheck(healthCheck bool) ServerOption
- func WithListener(lis net.Listener) ServerOption
- func WithServerEnableTracing(enableTracing bool) ServerOption
- func WithServerMetrics(metric bool) ServerOption
- func WithServerOption(opts ...grpc.ServerOption) ServerOption
- func WithServerTimeout(timeout time.Duration) ServerOption
- func WithServerUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
- func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func WithTLSConfig(c *tls.Config) ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client[T any] struct { // contains filtered or unexported fields }
func NewDefaultClient ¶
func NewDefaultClient[T any](endpoint, serverName string, generateClientFunc GenerateClientFunc[T], opts ...Option) *Client[T]
func (*Client[T]) NextClient ¶
NextClient 获得下一个client,通过这个方法,会获得最终的参数
func (*Client[T]) RebuildGrpcOpts ¶
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
func NewDefaultClientOptions ¶
func NewDefaultClientOptions(endpoint, serverName string) *ClientOptions
type GenerateClientFunc ¶
type GenerateClientFunc[T any] func(grpc.ClientConnInterface) T
type Option ¶
type Option func(o *ClientOptions)
func WithClientBalancer ¶
WithClientBalancer 设置负载均衡
func WithClientDialOption ¶
func WithClientDialOption(opts ...grpc.DialOption) Option
WithClientDialOption 设置 grpc 的 dial 选项
func WithClientDiscovery ¶
WithClientDiscovery 设置服务发现
func WithClientEnableMetrics ¶
WithClientEnableMetrics 设置是否开启 普罗米修斯 监控
func WithClientEnableTracing ¶
WithClientEnableTracing 设置是否开启链路追踪
func WithClientResolver ¶
WithClientResolver 设置服务解析
func WithClientStreamInterceptor ¶
func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) Option
WithClientStreamInterceptor 设置 stream 拦截器
func WithClientTLSConfig ¶
WithClientTLSConfig with tls config.
func WithClientTimeout ¶
WithClientTimeout 设置超时时间
func WithClientUnaryInterceptor ¶
func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) Option
WithClientUnaryInterceptor 设置 一元拦截器
type Server ¶
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
type ServerOption ¶
type ServerOption func(o *Server)
func AddServerOption ¶
func AddServerOption(opts ...grpc.ServerOption) ServerOption
func AddServerUnaryInterceptor ¶
func AddServerUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
func AddStreamInterceptor ¶
func AddStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
func WithAddress ¶
func WithAddress(address string) ServerOption
func WithHealthCheck ¶
func WithHealthCheck(healthCheck bool) ServerOption
WithHealthCheck 设置是否开启健康检查
func WithListener ¶
func WithListener(lis net.Listener) ServerOption
func WithServerEnableTracing ¶
func WithServerEnableTracing(enableTracing bool) ServerOption
func WithServerMetrics ¶
func WithServerMetrics(metric bool) ServerOption
WithServerMetrics 设置是否开启 普罗米修斯 监控
func WithServerOption ¶
func WithServerOption(opts ...grpc.ServerOption) ServerOption
func WithServerTimeout ¶
func WithServerTimeout(timeout time.Duration) ServerOption
func WithServerUnaryInterceptor ¶
func WithServerUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
func WithStreamInterceptor ¶
func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ServerOption
Click to show internal directories.
Click to hide internal directories.