mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 12:32:21 +00:00
152 lines
4.9 KiB
Go
152 lines
4.9 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// source: hello.proto
|
|
|
|
package main
|
|
|
|
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 String struct {
|
|
Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *String) Reset() { *m = String{} }
|
|
func (m *String) String() string { return proto.CompactTextString(m) }
|
|
func (*String) ProtoMessage() {}
|
|
func (*String) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_hello_5dd9d59ecabc789f, []int{0}
|
|
}
|
|
func (m *String) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_String.Unmarshal(m, b)
|
|
}
|
|
func (m *String) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_String.Marshal(b, m, deterministic)
|
|
}
|
|
func (dst *String) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_String.Merge(dst, src)
|
|
}
|
|
func (m *String) XXX_Size() int {
|
|
return xxx_messageInfo_String.Size(m)
|
|
}
|
|
func (m *String) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_String.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_String proto.InternalMessageInfo
|
|
|
|
func (m *String) GetValue() string {
|
|
if m != nil {
|
|
return m.Value
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterType((*String)(nil), "main.String")
|
|
}
|
|
|
|
// 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
|
|
|
|
// HelloServiceClient is the client API for HelloService service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
type HelloServiceClient interface {
|
|
Hello(ctx context.Context, in *String, opts ...grpc.CallOption) (*String, error)
|
|
}
|
|
|
|
type helloServiceClient struct {
|
|
cc *grpc.ClientConn
|
|
}
|
|
|
|
func NewHelloServiceClient(cc *grpc.ClientConn) HelloServiceClient {
|
|
return &helloServiceClient{cc}
|
|
}
|
|
|
|
func (c *helloServiceClient) Hello(ctx context.Context, in *String, opts ...grpc.CallOption) (*String, error) {
|
|
out := new(String)
|
|
err := c.cc.Invoke(ctx, "/main.HelloService/Hello", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// HelloServiceServer is the server API for HelloService service.
|
|
type HelloServiceServer interface {
|
|
Hello(context.Context, *String) (*String, error)
|
|
}
|
|
|
|
func RegisterHelloServiceServer(s *grpc.Server, srv HelloServiceServer) {
|
|
s.RegisterService(&_HelloService_serviceDesc, srv)
|
|
}
|
|
|
|
func _HelloService_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(String)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HelloServiceServer).Hello(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/main.HelloService/Hello",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HelloServiceServer).Hello(ctx, req.(*String))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
var _HelloService_serviceDesc = grpc.ServiceDesc{
|
|
ServiceName: "main.HelloService",
|
|
HandlerType: (*HelloServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Hello",
|
|
Handler: _HelloService_Hello_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "hello.proto",
|
|
}
|
|
|
|
func init() { proto.RegisterFile("hello.proto", fileDescriptor_hello_5dd9d59ecabc789f) }
|
|
|
|
var fileDescriptor_hello_5dd9d59ecabc789f = []byte{
|
|
// 107 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xce, 0x48, 0xcd, 0xc9,
|
|
0xc9, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xc9, 0x4d, 0xcc, 0xcc, 0x53, 0x92, 0xe3,
|
|
0x62, 0x0b, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x17, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d,
|
|
0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x70, 0x8c, 0x8c, 0xb9, 0x78, 0x3c, 0x40, 0x9a,
|
|
0x82, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0x85, 0x94, 0xb9, 0x58, 0xc1, 0x7c, 0x21, 0x1e, 0x3d,
|
|
0x90, 0x7e, 0x3d, 0x88, 0x66, 0x29, 0x14, 0x5e, 0x12, 0x1b, 0xd8, 0x06, 0x63, 0x40, 0x00, 0x00,
|
|
0x00, 0xff, 0xff, 0xa1, 0x2a, 0xa2, 0x5a, 0x70, 0x00, 0x00, 0x00,
|
|
}
|