mirror of https://github.com/grpc/grpc.git
The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)
https://grpc.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.7 KiB
109 lines
2.7 KiB
// Code generated by protoc-gen-go. |
|
// source: helloworld.proto |
|
// DO NOT EDIT! |
|
|
|
/* |
|
Package helloworld is a generated protocol buffer package. |
|
|
|
It is generated from these files: |
|
helloworld.proto |
|
|
|
It has these top-level messages: |
|
HelloRequest |
|
HelloReply |
|
*/ |
|
package helloworld |
|
|
|
import proto "github.com/golang/protobuf/proto" |
|
|
|
import ( |
|
context "golang.org/x/net/context" |
|
grpc "google.golang.org/grpc" |
|
) |
|
|
|
// Reference imports to suppress errors if they are not otherwise used. |
|
var _ context.Context |
|
var _ grpc.ClientConn |
|
|
|
// Reference imports to suppress errors if they are not otherwise used. |
|
var _ = proto.Marshal |
|
|
|
// The request message containing the user's name. |
|
type HelloRequest struct { |
|
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` |
|
} |
|
|
|
func (m *HelloRequest) Reset() { *m = HelloRequest{} } |
|
func (m *HelloRequest) String() string { return proto.CompactTextString(m) } |
|
func (*HelloRequest) ProtoMessage() {} |
|
|
|
// The response message containing the greetings |
|
type HelloReply struct { |
|
Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` |
|
} |
|
|
|
func (m *HelloReply) Reset() { *m = HelloReply{} } |
|
func (m *HelloReply) String() string { return proto.CompactTextString(m) } |
|
func (*HelloReply) ProtoMessage() {} |
|
|
|
func init() { |
|
} |
|
|
|
// Client API for Greeter service |
|
|
|
type GreeterClient interface { |
|
// Sends a greeting |
|
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) |
|
} |
|
|
|
type greeterClient struct { |
|
cc *grpc.ClientConn |
|
} |
|
|
|
func NewGreeterClient(cc *grpc.ClientConn) GreeterClient { |
|
return &greeterClient{cc} |
|
} |
|
|
|
func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) { |
|
out := new(HelloReply) |
|
err := grpc.Invoke(ctx, "/helloworld.Greeter/sayHello", in, out, c.cc, opts...) |
|
if err != nil { |
|
return nil, err |
|
} |
|
return out, nil |
|
} |
|
|
|
// Server API for Greeter service |
|
|
|
type GreeterServer interface { |
|
// Sends a greeting |
|
SayHello(context.Context, *HelloRequest) (*HelloReply, error) |
|
} |
|
|
|
func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) { |
|
s.RegisterService(&_Greeter_serviceDesc, srv) |
|
} |
|
|
|
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, buf []byte) (proto.Message, error) { |
|
in := new(HelloRequest) |
|
if err := proto.Unmarshal(buf, in); err != nil { |
|
return nil, err |
|
} |
|
out, err := srv.(GreeterServer).SayHello(ctx, in) |
|
if err != nil { |
|
return nil, err |
|
} |
|
return out, nil |
|
} |
|
|
|
var _Greeter_serviceDesc = grpc.ServiceDesc{ |
|
ServiceName: "helloworld.Greeter", |
|
HandlerType: (*GreeterServer)(nil), |
|
Methods: []grpc.MethodDesc{ |
|
{ |
|
MethodName: "sayHello", |
|
Handler: _Greeter_SayHello_Handler, |
|
}, |
|
}, |
|
Streams: []grpc.StreamDesc{}, |
|
}
|
|
|