[#124] rpc/client: Allow to pass custom grpc.CallOption
options
Those options are used when creating a new grc.ClientStream. Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
88789d5f4a
commit
3893ca67ac
2 changed files with 9 additions and 1 deletions
|
@ -55,7 +55,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
|
|||
StreamName: info.Name,
|
||||
ServerStreams: info.ServerStream(),
|
||||
ClientStreams: info.ClientStream(),
|
||||
}, toMethodName(info))
|
||||
}, toMethodName(info), c.grpcCallOpts...)
|
||||
if err != nil {
|
||||
cancel()
|
||||
return nil, err
|
||||
|
|
|
@ -24,6 +24,7 @@ type cfg struct {
|
|||
|
||||
tlsCfg *tls.Config
|
||||
grpcDialOpts []grpc.DialOption
|
||||
grpcCallOpts []grpc.CallOption
|
||||
|
||||
conn Conn
|
||||
}
|
||||
|
@ -127,3 +128,10 @@ func WithGRPCDialOptions(opts []grpc.DialOption) Option {
|
|||
c.grpcDialOpts = append(c.grpcDialOpts, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithGRPCDialOptions returns an option to specify grpc.Call.
|
||||
func WithGRPCCallOptions(opts []grpc.CallOption) Option {
|
||||
return func(c *cfg) {
|
||||
c.grpcCallOpts = append(c.grpcCallOpts, opts...)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue