Documentation ¶
Overview ¶
Package grpccli is grpc client with support for service discovery, logging, load balancing, trace, metrics, retries, circuit breaker.
Index ¶
- func Dial(ctx context.Context, endpoint string, opts ...Option) (*grpc.ClientConn, error)
- type Option
- func WithDialOptions(dialOptions ...grpc.DialOption) Option
- func WithDiscovery(discovery registry.Discovery) Option
- func WithEnableCircuitBreaker() Option
- func WithEnableLoadBalance() Option
- func WithEnableLog(log *zap.Logger) Option
- func WithEnableMetrics() Option
- func WithEnableRequestID() Option
- func WithEnableRetry() Option
- func WithEnableTrace() Option
- func WithOneWaySecure(serverName string, certFile string) Option
- func WithSecure(t string, serverName string, caFile string, certFile string, keyFile string) Option
- func WithStreamInterceptors(streamInterceptors ...grpc.StreamClientInterceptor) Option
- func WithTimeout(timeout time.Duration) Option
- func WithToken(enable bool, appID string, appKey string) Option
- func WithTwoWaySecure(serverName string, caFile string, certFile string, keyFile string) Option
- func WithUnaryInterceptors(unaryInterceptors ...grpc.UnaryClientInterceptor) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*options)
Option grpc dial options
func WithDialOptions ¶
func WithDialOptions(dialOptions ...grpc.DialOption) Option
WithDialOptions set dial options
func WithDiscovery ¶
WithDiscovery set dial discovery
func WithEnableCircuitBreaker ¶
func WithEnableCircuitBreaker() Option
WithEnableCircuitBreaker enable circuit breaker
func WithEnableLoadBalance ¶
func WithEnableLoadBalance() Option
WithEnableLoadBalance enable load balance
func WithOneWaySecure ¶
WithOneWaySecure set one-way secure
func WithSecure ¶
WithSecure support setting one-way or two-way secure
func WithStreamInterceptors ¶
func WithStreamInterceptors(streamInterceptors ...grpc.StreamClientInterceptor) Option
WithStreamInterceptors set dial streamInterceptors
func WithTwoWaySecure ¶
WithTwoWaySecure set two-way secure
func WithUnaryInterceptors ¶
func WithUnaryInterceptors(unaryInterceptors ...grpc.UnaryClientInterceptor) Option
WithUnaryInterceptors set dial unaryInterceptors
Click to show internal directories.
Click to hide internal directories.