micro-tests/client/drpc/proto/test_micro_rpc.pb.go

64 lines
1.7 KiB
Go
Raw Normal View History

// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.4
// source: test.proto
package pb
import (
context "context"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
)
type testServiceClient struct {
c client.Client
name string
}
func NewTestServiceClient(name string, c client.Client) TestServiceClient {
return &testServiceClient{c: c, name: name}
}
func (c *testServiceClient) Call(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error) {
rsp := &CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.Call", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *testServiceClient) Hello(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error) {
rsp := &CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.Hello", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
type testServiceServer struct {
TestServiceServer
}
func (h *testServiceServer) Call(ctx context.Context, req *CallReq, rsp *CallRsp) error {
return h.TestServiceServer.Call(ctx, req, rsp)
}
func (h *testServiceServer) Hello(ctx context.Context, req *CallReq, rsp *CallRsp) error {
return h.TestServiceServer.Hello(ctx, req, rsp)
}
func RegisterTestServiceServer(s server.Server, sh TestServiceServer, opts ...server.HandlerOption) error {
type testService interface {
Call(ctx context.Context, req *CallReq, rsp *CallRsp) error
Hello(ctx context.Context, req *CallReq, rsp *CallRsp) error
}
type TestService struct {
testService
}
h := &testServiceServer{sh}
var nopts []server.HandlerOption
return s.Handle(s.NewHandler(&TestService{h}, append(nopts, opts...)...))
}