client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*grpc.ClientConn
	// contains filtered or unexported fields
}

Client is a grpc client.

func New

func New(ctx context.Context, target string, optFns ...Option) (*Client, error)

New returns a new grpc client.

func (*Client) Close

func (c *Client) Close() error

Close closes the client.

func (*Client) Use

func (c *Client) Use(selector string, mws ...middleware.Middleware)

Use adds middlewares to the client. selector support /, /{package} /{package}.{service}, /{package}.{service}/{method}

type Option

type Option func(o *options)

Option is a function that configures the client.

func WithBalancerName

func WithBalancerName(name string) Option

WithBalancerName returns an Option that sets the balancer name of the client.

func WithDiscovery

func WithDiscovery(discovery sd.Discovery) Option

WithDiscovery returns an Option that sets the discoverer of the client.

func WithEnabledHealthCheck

func WithEnabledHealthCheck(enabledHealthCheck bool) Option

WithEnabledHealthCheck returns an Option that sets the health check of the client.

func WithGRPCOptions

func WithGRPCOptions(opts ...grpc.DialOption) Option

WithGRPCOptions returns an Option that sets the grpc options of the client.

func WithLogger

func WithLogger(logger xlog.Logger) Option

WithLogger returns an Option that sets the logger of the client.

func WithMiddlewares

func WithMiddlewares(mws ...middleware.Middleware) Option

WithMiddlewares returns an Option that sets the middlewares of the client.

func WithTLSConfig

func WithTLSConfig(tls *tls.Config) Option

WithTLSConfig returns an Option that sets the tls config of the client.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout returns an Option that sets the timeout of the client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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