From 0d4e26aceb6f23438f4f3d223b849cd49c5d72aa Mon Sep 17 00:00:00 2001 From: snoop Date: Wed, 28 Jun 2017 18:20:09 +0900 Subject: [PATCH] added golang --- golang/server_grpc.pb.go | 215 +++++++++++++++++++++++++++++++++++++++ src/main/proto/cmd | 1 + 2 files changed, 216 insertions(+) create mode 100644 golang/server_grpc.pb.go create mode 100644 src/main/proto/cmd diff --git a/golang/server_grpc.pb.go b/golang/server_grpc.pb.go new file mode 100644 index 0000000..dcc5b3f --- /dev/null +++ b/golang/server_grpc.pb.go @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: server_grpc.proto + +/* +Package server_grpc is a generated protocol buffer package. + +It is generated from these files: + server_grpc.proto + +It has these top-level messages: + ServerInput + ServerParam + ServerOutput +*/ +package server_grpc + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// 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.ProtoPackageIsVersion2 // please upgrade the proto package + +type ServerInput struct { + Target string `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"` + Params []*ServerParam `protobuf:"bytes,3,rep,name=params" json:"params,omitempty"` +} + +func (m *ServerInput) Reset() { *m = ServerInput{} } +func (m *ServerInput) String() string { return proto.CompactTextString(m) } +func (*ServerInput) ProtoMessage() {} +func (*ServerInput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *ServerInput) GetTarget() string { + if m != nil { + return m.Target + } + return "" +} + +func (m *ServerInput) GetMethod() string { + if m != nil { + return m.Method + } + return "" +} + +func (m *ServerInput) GetParams() []*ServerParam { + if m != nil { + return m.Params + } + return nil +} + +type ServerParam struct { + Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"` + Data string `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + IsCollection bool `protobuf:"varint,3,opt,name=isCollection" json:"isCollection,omitempty"` +} + +func (m *ServerParam) Reset() { *m = ServerParam{} } +func (m *ServerParam) String() string { return proto.CompactTextString(m) } +func (*ServerParam) ProtoMessage() {} +func (*ServerParam) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *ServerParam) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *ServerParam) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +func (m *ServerParam) GetIsCollection() bool { + if m != nil { + return m.IsCollection + } + return false +} + +type ServerOutput struct { + Result string `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"` +} + +func (m *ServerOutput) Reset() { *m = ServerOutput{} } +func (m *ServerOutput) String() string { return proto.CompactTextString(m) } +func (*ServerOutput) ProtoMessage() {} +func (*ServerOutput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *ServerOutput) GetResult() string { + if m != nil { + return m.Result + } + return "" +} + +func init() { + proto.RegisterType((*ServerInput)(nil), "ServerInput") + proto.RegisterType((*ServerParam)(nil), "ServerParam") + proto.RegisterType((*ServerOutput)(nil), "ServerOutput") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// 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.SupportPackageIsVersion4 + +// Client API for OverflowApiServer service + +type OverflowApiServerClient interface { + Exec(ctx context.Context, in *ServerInput, opts ...grpc.CallOption) (*ServerOutput, error) +} + +type overflowApiServerClient struct { + cc *grpc.ClientConn +} + +func NewOverflowApiServerClient(cc *grpc.ClientConn) OverflowApiServerClient { + return &overflowApiServerClient{cc} +} + +func (c *overflowApiServerClient) Exec(ctx context.Context, in *ServerInput, opts ...grpc.CallOption) (*ServerOutput, error) { + out := new(ServerOutput) + err := grpc.Invoke(ctx, "/OverflowApiServer/exec", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for OverflowApiServer service + +type OverflowApiServerServer interface { + Exec(context.Context, *ServerInput) (*ServerOutput, error) +} + +func RegisterOverflowApiServerServer(s *grpc.Server, srv OverflowApiServerServer) { + s.RegisterService(&_OverflowApiServer_serviceDesc, srv) +} + +func _OverflowApiServer_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ServerInput) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OverflowApiServerServer).Exec(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/OverflowApiServer/Exec", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OverflowApiServerServer).Exec(ctx, req.(*ServerInput)) + } + return interceptor(ctx, in, info, handler) +} + +var _OverflowApiServer_serviceDesc = grpc.ServiceDesc{ + ServiceName: "OverflowApiServer", + HandlerType: (*OverflowApiServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "exec", + Handler: _OverflowApiServer_Exec_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "server_grpc.proto", +} + +func init() { proto.RegisterFile("server_grpc.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 249 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xbf, 0x4e, 0xc3, 0x30, + 0x10, 0x87, 0x31, 0xa9, 0x22, 0xb8, 0x86, 0xa1, 0x1e, 0x20, 0x62, 0x40, 0x91, 0x05, 0x28, 0x93, + 0x87, 0xb2, 0xb1, 0x01, 0x13, 0x53, 0xab, 0x30, 0x31, 0x21, 0xe3, 0x5e, 0x4b, 0x24, 0xa7, 0xb6, + 0x9c, 0x4b, 0x81, 0x37, 0xe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x29, 0xef, 0x7e, 0x03, 0x00, 0x00, 0xff, + 0xff, 0xc4, 0xb1, 0x6c, 0x50, 0x5f, 0x01, 0x00, 0x00, +} diff --git a/src/main/proto/cmd b/src/main/proto/cmd new file mode 100644 index 0000000..cba582f --- /dev/null +++ b/src/main/proto/cmd @@ -0,0 +1 @@ +protoc -I src/main/proto/ src/main/proto/server_grpc.proto --go_out=plugins=grpc:golang \ No newline at end of file