Documentation
¶
Index ¶
- type CallResult
- type Client
- func (c *Client) Call(method string, request interface{}, response interface{}, ...) error
- func (c *Client) CallWithContext(ctx context.Context, method string, request interface{}, response interface{}, ...) error
- func (c *Client) CallWithMetadata(ctx context.Context, method string, request interface{}, response interface{}, ...) error
- func (c *Client) CallWithTimeout(method string, request interface{}, response interface{}, ...) error
- func (c *Client) Close() error
- func (c *Client) GetConnection() *grpc.ClientConn
- func (c *Client) GetState() string
- func (c *Client) GetTarget() string
- func (c *Client) IsConnected() bool
- func (c *Client) Ping() error
- func (c *Client) Reconnect() error
- func (c *Client) StreamCall(method string, request interface{}, opts ...grpc.CallOption) (grpc.ClientStream, error)
- func (c *Client) StreamCallWithContext(ctx context.Context, method string, request interface{}, ...) (grpc.ClientStream, error)
- func (c *Client) WithBlock() *Client
- func (c *Client) WithDefaultCallOptions(opts ...grpc.CallOption) *Client
- func (c *Client) WithInsecure() *Client
- func (c *Client) WithTimeout(timeout time.Duration) *Client
- func (c *Client) WithUserAgent(userAgent string) *Client
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client gRPC客户端
func NewClientWithOptions ¶
func NewClientWithOptions(target string, opts ...grpc.DialOption) (*Client, error)
NewClientWithOptions 使用自定义选项创建gRPC客户端
func (*Client) Call ¶
func (c *Client) Call(method string, request interface{}, response interface{}, opts ...grpc.CallOption) error
Call 调用gRPC方法
func (*Client) CallWithContext ¶
func (c *Client) CallWithContext(ctx context.Context, method string, request interface{}, response interface{}, opts ...grpc.CallOption) error
CallWithContext 使用上下文调用gRPC方法
func (*Client) CallWithMetadata ¶
func (c *Client) CallWithMetadata(ctx context.Context, method string, request interface{}, response interface{}, md map[string]string, opts ...grpc.CallOption) error
CallWithMetadata 使用元数据调用gRPC方法
func (*Client) CallWithTimeout ¶
func (c *Client) CallWithTimeout(method string, request interface{}, response interface{}, timeout time.Duration, opts ...grpc.CallOption) error
CallWithTimeout 使用超时调用gRPC方法
func (*Client) GetConnection ¶
func (c *Client) GetConnection() *grpc.ClientConn
GetConnection 获取gRPC连接
func (*Client) StreamCall ¶
func (c *Client) StreamCall(method string, request interface{}, opts ...grpc.CallOption) (grpc.ClientStream, error)
StreamCall 流式调用gRPC方法
func (*Client) StreamCallWithContext ¶
func (c *Client) StreamCallWithContext(ctx context.Context, method string, request interface{}, opts ...grpc.CallOption) (grpc.ClientStream, error)
StreamCallWithContext 使用上下文进行流式调用
func (*Client) WithDefaultCallOptions ¶
func (c *Client) WithDefaultCallOptions(opts ...grpc.CallOption) *Client
WithDefaultCallOptions 设置默认调用选项
func (*Client) WithTimeout ¶
WithTimeout 设置连接超时
func (*Client) WithUserAgent ¶
WithUserAgent 设置用户代理
Click to show internal directories.
Click to hide internal directories.