-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo.pb.go
73 lines (58 loc) · 1.73 KB
/
echo.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Code generated by protoc-gen-qrpcgo. DO NOT EDIT.
// source: echo.proto
package handler
import (
"context"
"github.com/cashwagon/qrpc/pkg/qrpc"
"github.com/golang/protobuf/proto"
_pb "github.com/cashwagon/qrpc/examples/pb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the qrpc package it is being compiled against.
const _ = qrpc.SupportPackageIsVersion1
// EchoAPIClient is the client API for EchoAPI service.
type EchoAPIClient interface {
Echo(ctx context.Context, reqID string, out *_pb.EchoResponse) error
}
type echoAPIClient struct {
cc *qrpc.ClientConn
}
func NewEchoAPIClient(cc *qrpc.ClientConn) EchoAPIClient {
cc.SetService("qrpc.test.api.EchoAPI.out")
return &echoAPIClient{cc}
}
func (c *echoAPIClient) Echo(ctx context.Context, reqID string, out *_pb.EchoResponse) error {
data, err := proto.Marshal(out)
if err != nil {
return err
}
return c.cc.Invoke(ctx, qrpc.Message{
Method: "Echo",
RequestID: reqID,
Data: data,
})
}
// EchoAPIServer is the server API for EchoAPI service.
type EchoAPIServer interface {
Echo(ctx context.Context, reqID string, in *_pb.EchoRequest) error
}
func RegisterEchoAPIServer(s *qrpc.Server, srv EchoAPIServer) {
s.RegisterService(&_EchoAPI_serviceDesc, srv)
}
func _EchoAPI_Echo_Handler(srv interface{}, ctx context.Context, reqID string, msg []byte) error {
in := new(_pb.EchoRequest)
if err := proto.Unmarshal(msg, in); err != nil {
return err
}
return srv.(EchoAPIServer).Echo(ctx, reqID, in)
}
var _EchoAPI_serviceDesc = qrpc.ServiceDesc{
ServiceName: "qrpc.test.api.EchoAPI.in",
HandlerType: (*EchoAPIServer)(nil),
Methods: []qrpc.MethodDesc{
{
MethodName: "Echo",
Handler: _EchoAPI_Echo_Handler,
},
},
}