Documentation ¶
Index ¶
- Constants
- func WrapperStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor
- func WrapperUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
- type Client
- func (c *Client) Close() error
- func (c *Client) Dial(opts ...Option) (*grpc.ClientConn, error)
- func (c *Client) Health() *healthpb.HealthCheckResponse
- func (c *Client) Init(opts ...Option)
- func (c *Client) Name() string
- func (c *Client) Stub(conn *grpc.ClientConn) interface{}
- func (c *Client) WithOptions(opts ...Option) *Client
- type ClientStreamWithContext
- func (w *ClientStreamWithContext) CloseSend() error
- func (w *ClientStreamWithContext) Context() context.Context
- func (w *ClientStreamWithContext) Header() (metadata.MD, error)
- func (w *ClientStreamWithContext) RecvMsg(msg interface{}) error
- func (w *ClientStreamWithContext) SendMsg(msg interface{}) error
- func (w *ClientStreamWithContext) SetContext(ctx context.Context)
- func (w *ClientStreamWithContext) Trailer() metadata.MD
- type Config
- type Option
- func Description(d string) Option
- func GRPCRegister(fn func(*grpc.ClientConn) interface{}) Option
- func ID(id string) Option
- func Logger(l zerolog.Logger) Option
- func Name(n string) Option
- func StreamClientInterceptors(uci []grpc.StreamClientInterceptor) Option
- func Target(t string) Option
- func Timeout(d time.Duration) Option
- func UnaryClientInterceptors(uci []grpc.UnaryClientInterceptor) Option
Constants ¶
const (
// DefaultName prefix client name
DefaultName = "client"
)
Variables ¶
This section is empty.
Functions ¶
func WrapperStreamClient ¶
func WrapperStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor
WrapperStreamClient creates a single interceptor out of a chain of many interceptors Execution is done in right-to-left order
func WrapperUnaryClient ¶
func WrapperUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
WrapperUnaryClient creates a single interceptor out of a chain of many interceptors Execution is done in right-to-left order
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client defines parameters for making calls to an HTTP server. The zero value for Client is a valid configuration.
func (*Client) Dial ¶
func (c *Client) Dial(opts ...Option) (*grpc.ClientConn, error)
Dial create a gRPC channel to communicate with the server
func (*Client) Health ¶
func (c *Client) Health() *healthpb.HealthCheckResponse
Health health check on client take in consideration a round trip to a server
func (*Client) WithOptions ¶
WithOptions clones the current Client, applies the supplied Options, and returns the resulting Client. It's safe to use concurrently.
type ClientStreamWithContext ¶
type ClientStreamWithContext struct {
// contains filtered or unexported fields
}
func WrapClientStreamWithContext ¶
func WrapClientStreamWithContext(stream grpc.ClientStream) *ClientStreamWithContext
WrapClientStreamWithContext returns a ClientStream that has the ability to overwrite context.
func (*ClientStreamWithContext) CloseSend ¶
func (w *ClientStreamWithContext) CloseSend() error
func (*ClientStreamWithContext) Context ¶
func (w *ClientStreamWithContext) Context() context.Context
Stream interface
func (*ClientStreamWithContext) Header ¶
func (w *ClientStreamWithContext) Header() (metadata.MD, error)
ClientStream interface
func (*ClientStreamWithContext) RecvMsg ¶
func (w *ClientStreamWithContext) RecvMsg(msg interface{}) error
func (*ClientStreamWithContext) SendMsg ¶
func (w *ClientStreamWithContext) SendMsg(msg interface{}) error
func (*ClientStreamWithContext) SetContext ¶
func (w *ClientStreamWithContext) SetContext(ctx context.Context)
func (*ClientStreamWithContext) Trailer ¶
func (w *ClientStreamWithContext) Trailer() metadata.MD
type Config ¶
type Config struct { ID string Name string Description string Target string // TCP address (e.g. localhost:8000) to listen on, ":http" if empty Format string GRPCRegister func(*grpc.ClientConn) interface{} Timeout time.Duration UnaryClientInterceptors []grpc.UnaryClientInterceptor // gRPC interceptors StreamClientInterceptors []grpc.StreamClientInterceptor // gRPC interceptors // contains filtered or unexported fields }
Config client configuaration options
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used to set options for the service.
func GRPCRegister ¶
func GRPCRegister(fn func(*grpc.ClientConn) interface{}) Option
GRPCRegister register client gRPC function
func StreamClientInterceptors ¶
func StreamClientInterceptors(uci []grpc.StreamClientInterceptor) Option
StreamClientInterceptors ...
func Timeout ¶
Timeout returns an Option that configures a timeout for dialing a ClientConn initially. This is valid if and only if WithBlock() is present.
func UnaryClientInterceptors ¶
func UnaryClientInterceptors(uci []grpc.UnaryClientInterceptor) Option
UnaryClientInterceptors ...