cf765a61a6
Implement gRPC client that can uniformly execute any RPC on the remote server. In the primary implementation, the client is a thin wrapper over gRPC client connection that is required to create the client. In the future, it is planned to expand the library with convenient functionality. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
23 lines
409 B
Go
23 lines
409 B
Go
package grpc
|
|
|
|
// Client represents client for exchanging messages
|
|
// with a remote server using gRPC protocol.
|
|
type Client struct {
|
|
*cfg
|
|
}
|
|
|
|
// Option is a Client's constructor option.
|
|
type Option func(*cfg)
|
|
|
|
// New creates, configures via options and returns new Client instance.
|
|
func New(opts ...Option) *Client {
|
|
c := defaultCfg()
|
|
|
|
for _, opt := range opts {
|
|
opt(c)
|
|
}
|
|
|
|
return &Client{
|
|
cfg: c,
|
|
}
|
|
}
|