client

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is the framework's client side instance, it contains the ctx, opt and interceptors. Create an instance of Client, by using NewClient().

func Dial

func Dial(target string, opts ...grpc.DialOption) (c *Conn, err error)

Dial create a grpc client conn It will return immediately without any blocking

func DialWithBlock

func DialWithBlock(ctx context.Context, target string, opts ...grpc.DialOption) (c *Conn, err error)

DialWithBlock create a grpc client conn with context It will block until create connection successfully 核心依赖建议使用DialWithBlock,确保能够拉到服务提供者节点再进行后续的启动操作

func (*Conn) GrpcConn

func (c *Conn) GrpcConn() *grpc.ClientConn

GrpcConn exports grpc connection

func (*Conn) Use

func (c *Conn) Use(interceptors ...grpc.UnaryClientInterceptor) *Conn

Use attachs a global inteceptor to the Client. For example, this is the right place for a circuit breaker or error management inteceptor. This function is not concurrency safe.

func (*Conn) UseStream

func (c *Conn) UseStream(interceptors ...grpc.StreamClientInterceptor) *Conn

UseStream attachs a global inteceptor to the Client. For example, this is the right place for a circuit breaker or error management inteceptor. This function is not concurrency safe.

Jump to

Keyboard shortcuts

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