micro/util/client/client.go
Vasiliy Tolstov 06136312bb
regen files with never protoc (#6)
* regen files with never protoc
* rewrite import path

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-08-19 17:47:17 +03:00

26 lines
704 B
Go

package client
import (
"context"
"github.com/unistack-org/micro/v3/client"
)
type staticClient struct {
address string
client.Client
}
func (s *staticClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {
return s.Client.Call(ctx, req, rsp, append(opts, client.WithAddress(s.address))...)
}
func (s *staticClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Stream, error) {
return s.Client.Stream(ctx, req, append(opts, client.WithAddress(s.address))...)
}
// StaticClient sets an address on every call
func Static(address string, c client.Client) client.Client {
return &staticClient{address, c}
}