micro/client/client_call_options.go
Vasiliy Tolstov 6f6f850af6
Some checks failed
lint / lint (pull_request) Failing after 1m31s
pr / test (pull_request) Failing after 2m37s
move options to dedicated package
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-07-29 00:40:58 +03:00

26 lines
662 B
Go

package client
import (
"context"
"go.unistack.org/micro/v4/options"
)
type clientCallOptions struct {
Client
opts []options.Option
}
func (s *clientCallOptions) Call(ctx context.Context, req Request, rsp interface{}, opts ...options.Option) error {
return s.Client.Call(ctx, req, rsp, append(s.opts, opts...)...)
}
func (s *clientCallOptions) Stream(ctx context.Context, req Request, opts ...options.Option) (Stream, error) {
return s.Client.Stream(ctx, req, append(s.opts, opts...)...)
}
// NewClientCallOptions add CallOption to every call
func NewClientCallOptions(c Client, opts ...options.Option) Client {
return &clientCallOptions{c, opts}
}