xgrpc_client

package
v1.0.1-0...-e52dcc8 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeServerCons

func ChangeServerCons(serverName string, servers []*server.ServiceInfo) ([]*grpc.ClientConn, error)

ChangeServerCons 改变服务的链接

func InitServerGrpcClient

func InitServerGrpcClient(dis discover.Discover, config *registry.RegistryConfig)

创建客户端

func RangeConns

func RangeConns(f func(key, value interface{}) bool)

RangeConns 遍历本地所有服务

Types

type ConnGrpcClient

type ConnGrpcClient struct {
	// contains filtered or unexported fields
}

ConnGrpcClient 需要传入构建好的链接进行服务的调用

func NewConnGrpcClient

func NewConnGrpcClient(cc *grpc.ClientConn) *ConnGrpcClient

创建客户端

func (*ConnGrpcClient) Call

func (c *ConnGrpcClient) Call(serverName string, int interface{}, ctx context.Context, method string, result interface{}, params ...interface{}) error

int 接口 ctx上下文 method 调用的方法 result 返回值 该调用方式暂时只支持单个返回 params 请求参数

type GrpcClient

type GrpcClient interface {
	//调用远程的服务
	Call(serverName string, int interface{}, ctx context.Context, method string, result interface{}, params ...interface{}) error
}

GrpcClient grpc 客户端

type ServerGrpcClient

type ServerGrpcClient struct {
	// contains filtered or unexported fields
}

ServerGrpcClient 服务使用的客户端

func BrianGrpcClient

func BrianGrpcClient() (*ServerGrpcClient, error)

func (*ServerGrpcClient) Call

func (c *ServerGrpcClient) Call(serverName string, int interface{}, ctx context.Context, method string, result interface{}, params ...interface{}) error

int 接口 ctx上下文 method 调用的方法 result 返回值 该调用方式暂时只支持单个返回 params 请求参数

Jump to

Keyboard shortcuts

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