123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- // Code generated by protoc-gen-go. DO NOT EDIT.
- // source: demo.proto
- //声明 包名
- package proto
- import (
- context "context"
- fmt "fmt"
- proto "github.com/golang/protobuf/proto"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
- math "math"
- )
- // Reference imports to suppress errors if they are not otherwise used.
- var _ = proto.Marshal
- var _ = fmt.Errorf
- var _ = math.Inf
- // This is a compile-time assertion to ensure that this generated file
- // is compatible with the proto package it is being compiled against.
- // A compilation error at this line likely means your copy of the
- // proto package needs to be updated.
- const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
- //服务参数
- type DemoReq struct {
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
- }
- func (m *DemoReq) Reset() { *m = DemoReq{} }
- func (m *DemoReq) String() string { return proto.CompactTextString(m) }
- func (*DemoReq) ProtoMessage() {}
- func (*DemoReq) Descriptor() ([]byte, []int) {
- return fileDescriptor_ca53982754088a9d, []int{0}
- }
- func (m *DemoReq) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_DemoReq.Unmarshal(m, b)
- }
- func (m *DemoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_DemoReq.Marshal(b, m, deterministic)
- }
- func (m *DemoReq) XXX_Merge(src proto.Message) {
- xxx_messageInfo_DemoReq.Merge(m, src)
- }
- func (m *DemoReq) XXX_Size() int {
- return xxx_messageInfo_DemoReq.Size(m)
- }
- func (m *DemoReq) XXX_DiscardUnknown() {
- xxx_messageInfo_DemoReq.DiscardUnknown(m)
- }
- var xxx_messageInfo_DemoReq proto.InternalMessageInfo
- func (m *DemoReq) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
- }
- //标准字符串返回结果
- type DemoRep struct {
- Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
- }
- func (m *DemoRep) Reset() { *m = DemoRep{} }
- func (m *DemoRep) String() string { return proto.CompactTextString(m) }
- func (*DemoRep) ProtoMessage() {}
- func (*DemoRep) Descriptor() ([]byte, []int) {
- return fileDescriptor_ca53982754088a9d, []int{1}
- }
- func (m *DemoRep) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_DemoRep.Unmarshal(m, b)
- }
- func (m *DemoRep) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_DemoRep.Marshal(b, m, deterministic)
- }
- func (m *DemoRep) XXX_Merge(src proto.Message) {
- xxx_messageInfo_DemoRep.Merge(m, src)
- }
- func (m *DemoRep) XXX_Size() int {
- return xxx_messageInfo_DemoRep.Size(m)
- }
- func (m *DemoRep) XXX_DiscardUnknown() {
- xxx_messageInfo_DemoRep.DiscardUnknown(m)
- }
- var xxx_messageInfo_DemoRep proto.InternalMessageInfo
- func (m *DemoRep) GetData() string {
- if m != nil {
- return m.Data
- }
- return ""
- }
- func init() {
- proto.RegisterType((*DemoReq)(nil), "proto.DemoReq")
- proto.RegisterType((*DemoRep)(nil), "proto.DemoRep")
- }
- func init() {
- proto.RegisterFile("demo.proto", fileDescriptor_ca53982754088a9d)
- }
- var fileDescriptor_ca53982754088a9d = []byte{
- // 118 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x49, 0xcd, 0xcd,
- 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x4a, 0xb2, 0x5c, 0xec, 0x2e, 0xa9,
- 0xb9, 0xf9, 0x41, 0xa9, 0x85, 0x42, 0x42, 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a,
- 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0x36, 0x42, 0xba, 0x00, 0x24, 0x9d, 0x92, 0x58, 0x92, 0x08, 0x93,
- 0x06, 0xb1, 0x8d, 0xcc, 0xb8, 0xb8, 0x41, 0xd2, 0xc1, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x42,
- 0xea, 0x5c, 0xcc, 0xc1, 0x89, 0x95, 0x42, 0x7c, 0x10, 0x2b, 0xf4, 0xa0, 0x06, 0x4b, 0xa1, 0xf2,
- 0x0b, 0x94, 0x18, 0x92, 0xd8, 0xc0, 0x02, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xd5,
- 0xa7, 0x42, 0x91, 0x00, 0x00, 0x00,
- }
- // Reference imports to suppress errors if they are not otherwise used.
- var _ context.Context
- var _ grpc.ClientConnInterface
- // This is a compile-time assertion to ensure that this generated file
- // is compatible with the grpc package it is being compiled against.
- const _ = grpc.SupportPackageIsVersion6
- // DemoServiceClient is the client API for DemoService service.
- //
- // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
- type DemoServiceClient interface {
- //rpc
- Say(ctx context.Context, in *DemoReq, opts ...grpc.CallOption) (*DemoRep, error)
- }
- type demoServiceClient struct {
- cc grpc.ClientConnInterface
- }
- func NewDemoServiceClient(cc grpc.ClientConnInterface) DemoServiceClient {
- return &demoServiceClient{cc}
- }
- func (c *demoServiceClient) Say(ctx context.Context, in *DemoReq, opts ...grpc.CallOption) (*DemoRep, error) {
- out := new(DemoRep)
- err := c.cc.Invoke(ctx, "/proto.DemoService/Say", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
- }
- // DemoServiceServer is the server API for DemoService service.
- type DemoServiceServer interface {
- //rpc
- Say(context.Context, *DemoReq) (*DemoRep, error)
- }
- // UnimplementedDemoServiceServer can be embedded to have forward compatible implementations.
- type UnimplementedDemoServiceServer struct {
- }
- func (*UnimplementedDemoServiceServer) Say(ctx context.Context, req *DemoReq) (*DemoRep, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Say not implemented")
- }
- func RegisterDemoServiceServer(s *grpc.Server, srv DemoServiceServer) {
- s.RegisterService(&_DemoService_serviceDesc, srv)
- }
- func _DemoService_Say_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DemoReq)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(DemoServiceServer).Say(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/proto.DemoService/Say",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(DemoServiceServer).Say(ctx, req.(*DemoReq))
- }
- return interceptor(ctx, in, info, handler)
- }
- var _DemoService_serviceDesc = grpc.ServiceDesc{
- ServiceName: "proto.DemoService",
- HandlerType: (*DemoServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "Say",
- Handler: _DemoService_Say_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "demo.proto",
- }
|