2021-07-05 16:26:57 +03:00
|
|
|
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
2021-10-27 01:24:35 +03:00
|
|
|
// protoc-gen-go-micro version: v3.5.3
|
2021-07-05 16:26:57 +03:00
|
|
|
// source: test.proto
|
|
|
|
|
|
|
|
package pb
|
|
|
|
|
|
|
|
import (
|
|
|
|
context "context"
|
2022-01-24 22:44:26 +03:00
|
|
|
|
2021-10-27 01:24:35 +03:00
|
|
|
api "go.unistack.org/micro/v3/api"
|
|
|
|
client "go.unistack.org/micro/v3/client"
|
|
|
|
server "go.unistack.org/micro/v3/server"
|
2021-07-05 16:26:57 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
for _, endpoint := range TestServiceEndpoints {
|
|
|
|
nopts = append(nopts, api.WithEndpoint(&endpoint))
|
|
|
|
}
|
|
|
|
return s.Handle(s.NewHandler(&TestService{h}, append(nopts, opts...)...))
|
|
|
|
}
|