client

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CLIENT = "client"
)

Variables

View Source
var (
	// ErrInvalidStream returned when the stream is invalid
	ErrInvalidStream = errors.New("invalid client stream")
)

Functions

This section is empty.

Types

type CallFn

type CallFn func(conn pool.Connection) error

CallFn function for Call method

type CallOption

type CallOption interface{}

CallOption is used to pass client call options

type Client

type Client interface {
	component.Component
	// Call client method
	Call(ctx context.Context, sc ServiceClient, method string, req interface{}, res interface{}, opts ...CallOption) error
	// Stream client
	Stream(ctx context.Context, sc ServiceClient, desc interface{}, method string, req interface{}, opts ...CallOption) (StreamClient, error)
	// Get client connection
	Dial(address string, opts ...DialOption) (pool.Connection, error)
}

Client interface to implement custom clients

type DialOption

type DialOption interface{}

DialOption is used to pass clients' dial options

type ServiceClient

type ServiceClient interface {
	// Get service name of the client
	GetServiceName() string
	// Get dial options for the client
	GetDialOptions() []DialOption
}

ServiceClient is used by the generated code to return service config

type StreamClient

type StreamClient interface {
	// Send request
	Send(req interface{}) error
	// Close send and receive response
	CloseAndRecv(res interface{}) error
	// Receive response
	Recv(res interface{}) error
	// Close client connection
	CloseConn() error
}

StreamClient interface is used by client implementation for streaming

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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