Documentation ¶
Overview ¶
Package proto is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterClient) error
- func RegisterGreeterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServer) error
- func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
- func RegisterTestImportServer(s grpc.ServiceRegistrar, srv TestImportServer)
- type Gender
- type GreeterClient
- type GreeterServer
- type Greeter_SayHelloBidirectionalStreamClient
- type Greeter_SayHelloBidirectionalStreamServer
- type Greeter_SayHelloClientStreamClient
- type Greeter_SayHelloClientStreamServer
- type Greeter_SayHelloServerStreamClient
- type Greeter_SayHelloServerStreamServer
- type HelloReply
- func (*HelloReply) Descriptor() ([]byte, []int)deprecated
- func (x *HelloReply) GetGender() Gender
- func (x *HelloReply) GetItems() []string
- func (x *HelloReply) GetMessage() string
- func (*HelloReply) ProtoMessage()
- func (x *HelloReply) ProtoReflect() protoreflect.Message
- func (x *HelloReply) Reset()
- func (x *HelloReply) String() string
- type HelloRequest
- func (*HelloRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HelloRequest) GetGender() Gender
- func (x *HelloRequest) GetItems() []string
- func (x *HelloRequest) GetName() string
- func (x *HelloRequest) GetPerson() *Person
- func (*HelloRequest) ProtoMessage()
- func (x *HelloRequest) ProtoReflect() protoreflect.Message
- func (x *HelloRequest) Reset()
- func (x *HelloRequest) String() string
- type Person
- type PlusReply
- type PlusRequest
- type Request
- type Response
- type TestImportClient
- type TestImportServer
- type UnimplementedGreeterServer
- func (UnimplementedGreeterServer) Plus(context.Context, *PlusRequest) (*PlusReply, error)
- func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error)
- func (UnimplementedGreeterServer) SayHelloAfterDelay(context.Context, *HelloRequest) (*HelloReply, error)
- func (UnimplementedGreeterServer) SayHelloBidirectionalStream(Greeter_SayHelloBidirectionalStreamServer) error
- func (UnimplementedGreeterServer) SayHelloClientStream(Greeter_SayHelloClientStreamServer) error
- func (UnimplementedGreeterServer) SayHelloServerStream(*HelloRequest, Greeter_SayHelloServerStreamServer) error
- type UnimplementedTestImportServer
- type UnsafeGreeterServer
- type UnsafeTestImportServer
- type User
Constants ¶
This section is empty.
Variables ¶
var ( Gender_name = map[int32]string{ 0: "GENDER_UNKNOWN", 1: "GENDER_MALE", 2: "GENDER_FEMALE", } Gender_value = map[string]int32{ "GENDER_UNKNOWN": 0, "GENDER_MALE": 1, "GENDER_FEMALE": 2, } )
Enum value maps for Gender.
var File_helloworld_proto protoreflect.FileDescriptor
var File_proto_import_proto protoreflect.FileDescriptor
var File_proto_src_proto protoreflect.FileDescriptor
var Greeter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "helloworld.Greeter", HandlerType: (*GreeterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SayHello", Handler: _Greeter_SayHello_Handler, }, { MethodName: "Plus", Handler: _Greeter_Plus_Handler, }, { MethodName: "SayHelloAfterDelay", Handler: _Greeter_SayHelloAfterDelay_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "SayHelloServerStream", Handler: _Greeter_SayHelloServerStream_Handler, ServerStreams: true, }, { StreamName: "SayHelloClientStream", Handler: _Greeter_SayHelloClientStream_Handler, ClientStreams: true, }, { StreamName: "SayHelloBidirectionalStream", Handler: _Greeter_SayHelloBidirectionalStream_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "helloworld.proto", }
Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var TestImport_ServiceDesc = grpc.ServiceDesc{ ServiceName: "helloworld.TestImport", HandlerType: (*TestImportServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Run", Handler: _TestImport_Run_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/src.proto", }
TestImport_ServiceDesc is the grpc.ServiceDesc for TestImport service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterGreeterHandler ¶
func RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterGreeterHandler registers the http handlers for service Greeter to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterGreeterHandlerClient ¶
func RegisterGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterClient) error
RegisterGreeterHandlerClient registers the http handlers for service Greeter to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "GreeterClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "GreeterClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "GreeterClient" to call the correct interceptors.
func RegisterGreeterHandlerFromEndpoint ¶
func RegisterGreeterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterGreeterHandlerFromEndpoint is same as RegisterGreeterHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterGreeterHandlerServer ¶
func RegisterGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServer) error
RegisterGreeterHandlerServer registers the http handlers for service Greeter to "mux". UnaryRPC :call GreeterServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterGreeterHandlerFromEndpoint instead.
func RegisterGreeterServer ¶
func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
func RegisterTestImportServer ¶
func RegisterTestImportServer(s grpc.ServiceRegistrar, srv TestImportServer)
Types ¶
type Gender ¶
type Gender int32
func (Gender) Descriptor ¶
func (Gender) Descriptor() protoreflect.EnumDescriptor
func (Gender) EnumDescriptor
deprecated
func (Gender) Number ¶
func (x Gender) Number() protoreflect.EnumNumber
func (Gender) Type ¶
func (Gender) Type() protoreflect.EnumType
type GreeterClient ¶
type GreeterClient interface { // Unary RPC. SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) Plus(ctx context.Context, in *PlusRequest, opts ...grpc.CallOption) (*PlusReply, error) SayHelloAfterDelay(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) // Server side streaming. SayHelloServerStream(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (Greeter_SayHelloServerStreamClient, error) // Client side streaming. SayHelloClientStream(ctx context.Context, opts ...grpc.CallOption) (Greeter_SayHelloClientStreamClient, error) // Bidirectional streaming. SayHelloBidirectionalStream(ctx context.Context, opts ...grpc.CallOption) (Greeter_SayHelloBidirectionalStreamClient, error) }
GreeterClient is the client API for Greeter service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewGreeterClient ¶
func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient
type GreeterServer ¶
type GreeterServer interface { // Unary RPC. SayHello(context.Context, *HelloRequest) (*HelloReply, error) Plus(context.Context, *PlusRequest) (*PlusReply, error) SayHelloAfterDelay(context.Context, *HelloRequest) (*HelloReply, error) // Server side streaming. SayHelloServerStream(*HelloRequest, Greeter_SayHelloServerStreamServer) error // Client side streaming. SayHelloClientStream(Greeter_SayHelloClientStreamServer) error // Bidirectional streaming. SayHelloBidirectionalStream(Greeter_SayHelloBidirectionalStreamServer) error // contains filtered or unexported methods }
GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility
type Greeter_SayHelloBidirectionalStreamClient ¶
type Greeter_SayHelloBidirectionalStreamClient interface { Send(*HelloRequest) error Recv() (*HelloReply, error) grpc.ClientStream }
type Greeter_SayHelloBidirectionalStreamServer ¶
type Greeter_SayHelloBidirectionalStreamServer interface { Send(*HelloReply) error Recv() (*HelloRequest, error) grpc.ServerStream }
type Greeter_SayHelloClientStreamClient ¶
type Greeter_SayHelloClientStreamClient interface { Send(*HelloRequest) error CloseAndRecv() (*HelloReply, error) grpc.ClientStream }
type Greeter_SayHelloClientStreamServer ¶
type Greeter_SayHelloClientStreamServer interface { SendAndClose(*HelloReply) error Recv() (*HelloRequest, error) grpc.ServerStream }
type Greeter_SayHelloServerStreamClient ¶
type Greeter_SayHelloServerStreamClient interface { Recv() (*HelloReply, error) grpc.ClientStream }
type Greeter_SayHelloServerStreamServer ¶
type Greeter_SayHelloServerStreamServer interface { Send(*HelloReply) error grpc.ServerStream }
type HelloReply ¶
type HelloReply struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` Items []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` Gender Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"` // contains filtered or unexported fields }
func (*HelloReply) Descriptor
deprecated
func (*HelloReply) Descriptor() ([]byte, []int)
Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.
func (*HelloReply) GetGender ¶
func (x *HelloReply) GetGender() Gender
func (*HelloReply) GetItems ¶
func (x *HelloReply) GetItems() []string
func (*HelloReply) GetMessage ¶
func (x *HelloReply) GetMessage() string
func (*HelloReply) ProtoMessage ¶
func (*HelloReply) ProtoMessage()
func (*HelloReply) ProtoReflect ¶
func (x *HelloReply) ProtoReflect() protoreflect.Message
func (*HelloReply) Reset ¶
func (x *HelloReply) Reset()
func (*HelloReply) String ¶
func (x *HelloReply) String() string
type HelloRequest ¶
type HelloRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Items []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` Gender Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"` Person *Person `protobuf:"bytes,4,opt,name=person,proto3" json:"person,omitempty"` // contains filtered or unexported fields }
func (*HelloRequest) Descriptor
deprecated
func (*HelloRequest) Descriptor() ([]byte, []int)
Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
func (*HelloRequest) GetGender ¶
func (x *HelloRequest) GetGender() Gender
func (*HelloRequest) GetItems ¶
func (x *HelloRequest) GetItems() []string
func (*HelloRequest) GetName ¶
func (x *HelloRequest) GetName() string
func (*HelloRequest) GetPerson ¶
func (x *HelloRequest) GetPerson() *Person
func (*HelloRequest) ProtoMessage ¶
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) ProtoReflect ¶
func (x *HelloRequest) ProtoReflect() protoreflect.Message
func (*HelloRequest) Reset ¶
func (x *HelloRequest) Reset()
func (*HelloRequest) String ¶
func (x *HelloRequest) String() string
type Person ¶
type Person struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` // contains filtered or unexported fields }
func (*Person) Descriptor
deprecated
func (*Person) ProtoMessage ¶
func (*Person) ProtoMessage()
func (*Person) ProtoReflect ¶
func (x *Person) ProtoReflect() protoreflect.Message
type PlusReply ¶
type PlusReply struct { Result int64 `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` // contains filtered or unexported fields }
func (*PlusReply) Descriptor
deprecated
func (*PlusReply) ProtoMessage ¶
func (*PlusReply) ProtoMessage()
func (*PlusReply) ProtoReflect ¶
func (x *PlusReply) ProtoReflect() protoreflect.Message
type PlusRequest ¶
type PlusRequest struct { A int64 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` B int64 `protobuf:"varint,2,opt,name=b,proto3" json:"b,omitempty"` // contains filtered or unexported fields }
func (*PlusRequest) Descriptor
deprecated
func (*PlusRequest) Descriptor() ([]byte, []int)
Deprecated: Use PlusRequest.ProtoReflect.Descriptor instead.
func (*PlusRequest) GetA ¶
func (x *PlusRequest) GetA() int64
func (*PlusRequest) GetB ¶
func (x *PlusRequest) GetB() int64
func (*PlusRequest) ProtoMessage ¶
func (*PlusRequest) ProtoMessage()
func (*PlusRequest) ProtoReflect ¶
func (x *PlusRequest) ProtoReflect() protoreflect.Message
func (*PlusRequest) Reset ¶
func (x *PlusRequest) Reset()
func (*PlusRequest) String ¶
func (x *PlusRequest) String() string
type Request ¶
type Request struct { User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` Body string `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` // contains filtered or unexported fields }
func (*Request) Descriptor
deprecated
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { Body string `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type TestImportClient ¶
type TestImportClient interface {
Run(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}
TestImportClient is the client API for TestImport service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewTestImportClient ¶
func NewTestImportClient(cc grpc.ClientConnInterface) TestImportClient
type TestImportServer ¶
type TestImportServer interface { Run(context.Context, *Request) (*Response, error) // contains filtered or unexported methods }
TestImportServer is the server API for TestImport service. All implementations must embed UnimplementedTestImportServer for forward compatibility
type UnimplementedGreeterServer ¶
type UnimplementedGreeterServer struct { }
UnimplementedGreeterServer must be embedded to have forward compatible implementations.
func (UnimplementedGreeterServer) Plus ¶
func (UnimplementedGreeterServer) Plus(context.Context, *PlusRequest) (*PlusReply, error)
func (UnimplementedGreeterServer) SayHello ¶
func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error)
func (UnimplementedGreeterServer) SayHelloAfterDelay ¶
func (UnimplementedGreeterServer) SayHelloAfterDelay(context.Context, *HelloRequest) (*HelloReply, error)
func (UnimplementedGreeterServer) SayHelloBidirectionalStream ¶
func (UnimplementedGreeterServer) SayHelloBidirectionalStream(Greeter_SayHelloBidirectionalStreamServer) error
func (UnimplementedGreeterServer) SayHelloClientStream ¶
func (UnimplementedGreeterServer) SayHelloClientStream(Greeter_SayHelloClientStreamServer) error
func (UnimplementedGreeterServer) SayHelloServerStream ¶
func (UnimplementedGreeterServer) SayHelloServerStream(*HelloRequest, Greeter_SayHelloServerStreamServer) error
type UnimplementedTestImportServer ¶
type UnimplementedTestImportServer struct { }
UnimplementedTestImportServer must be embedded to have forward compatible implementations.
type UnsafeGreeterServer ¶
type UnsafeGreeterServer interface {
// contains filtered or unexported methods
}
UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GreeterServer will result in compilation errors.
type UnsafeTestImportServer ¶
type UnsafeTestImportServer interface {
// contains filtered or unexported methods
}
UnsafeTestImportServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TestImportServer will result in compilation errors.
type User ¶
type User struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message