micro-tests/server/combo/ndpb/test_drpc.pb.go
Vasiliy Tolstov 38fb19589a add combined server test
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-21 13:08:51 +03:00

104 lines
2.7 KiB
Go

// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: (devel)
// source: test.proto
package pb
import (
context "context"
errors "errors"
proto1 "go.unistack.org/micro-tests/server/combo/proto"
proto "google.golang.org/protobuf/proto"
drpc "storj.io/drpc"
drpcerr "storj.io/drpc/drpcerr"
)
type drpcEncoding_File_test_proto struct{}
func (drpcEncoding_File_test_proto) Marshal(msg drpc.Message) ([]byte, error) {
return proto.Marshal(msg.(proto.Message))
}
func (drpcEncoding_File_test_proto) MarshalAppend(buf []byte, msg drpc.Message) ([]byte, error) {
return proto.MarshalOptions{}.MarshalAppend(buf, msg.(proto.Message))
}
func (drpcEncoding_File_test_proto) Unmarshal(buf []byte, msg drpc.Message) error {
return proto.Unmarshal(buf, msg.(proto.Message))
}
type DRPCTestClient interface {
DRPCConn() drpc.Conn
Call(ctx context.Context, in *proto1.CallReq) (*proto1.CallRsp, error)
}
type drpcTestClient struct {
cc drpc.Conn
}
func NewDRPCTestClient(cc drpc.Conn) DRPCTestClient {
return &drpcTestClient{cc}
}
func (c *drpcTestClient) DRPCConn() drpc.Conn { return c.cc }
func (c *drpcTestClient) Call(ctx context.Context, in *proto1.CallReq) (*proto1.CallRsp, error) {
out := new(proto1.CallRsp)
err := c.cc.Invoke(ctx, "/test.v1.Test/Call", drpcEncoding_File_test_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
type DRPCTestServer interface {
Call(context.Context, *proto1.CallReq) (*proto1.CallRsp, error)
}
type DRPCTestUnimplementedServer struct{}
func (s *DRPCTestUnimplementedServer) Call(context.Context, *proto1.CallReq) (*proto1.CallRsp, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
type DRPCTestDescription struct{}
func (DRPCTestDescription) NumMethods() int { return 1 }
func (DRPCTestDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
case 0:
return "/test.v1.Test/Call", drpcEncoding_File_test_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCTestServer).
Call(
ctx,
in1.(*proto1.CallReq),
)
}, DRPCTestServer.Call, true
default:
return "", nil, nil, nil, false
}
}
func DRPCRegisterTest(mux drpc.Mux, impl DRPCTestServer) error {
return mux.Register(impl, DRPCTestDescription{})
}
type DRPCTest_CallStream interface {
drpc.Stream
SendAndClose(*proto1.CallRsp) error
}
type drpcTest_CallStream struct {
drpc.Stream
}
func (x *drpcTest_CallStream) SendAndClose(m *proto1.CallRsp) error {
if err := x.MsgSend(m, drpcEncoding_File_test_proto{}); err != nil {
return err
}
return x.CloseSend()
}