33 lines
655 B
Go
33 lines
655 B
Go
package supportClient
|
|
|
|
import (
|
|
"context"
|
|
|
|
support "lone-services/rpc/support/pb"
|
|
|
|
"github.com/zeromicro/go-zero/zrpc"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type (
|
|
CallReq = support.CallReq
|
|
Response = support.Response
|
|
|
|
Support interface {
|
|
Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Response, error)
|
|
}
|
|
|
|
defaultSupport struct {
|
|
cli zrpc.Client
|
|
}
|
|
)
|
|
|
|
func NewSupport(cli zrpc.Client) Support {
|
|
return &defaultSupport{cli: cli}
|
|
}
|
|
|
|
func (m *defaultSupport) Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Response, error) {
|
|
client := support.NewSupportClient(m.cli.Conn())
|
|
return client.Call(ctx, in, opts...)
|
|
}
|