Documentation ¶
Overview ¶
Package gen is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterDefaultHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterDefaultHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DefaultClient) error
- func RegisterDefaultHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterDefaultHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DefaultServer) error
- func RegisterDefaultServer(s grpc.ServiceRegistrar, srv DefaultServer)
- type DefaultClient
- type DefaultServer
- type ErrorReq
- type ErrorResp
- type GreetingReq
- type GreetingResp
- type ReviewReq
- func (*ReviewReq) Descriptor() ([]byte, []int)deprecated
- func (x *ReviewReq) GetAuthor() string
- func (x *ReviewReq) GetMessage() string
- func (x *ReviewReq) GetRating() int64
- func (*ReviewReq) ProtoMessage()
- func (x *ReviewReq) ProtoReflect() protoreflect.Message
- func (x *ReviewReq) Reset()
- func (x *ReviewReq) String() string
- type ReviewResp
- type UnimplementedDefaultServer
- type UnsafeDefaultServer
Constants ¶
const ( Default_Greeting_FullMethodName = "/com.github.veqryn.awesome.Default/Greeting" Default_Review_FullMethodName = "/com.github.veqryn.awesome.Default/Review" Default_Error_FullMethodName = "/com.github.veqryn.awesome.Default/Error" )
Variables ¶
var Default_ServiceDesc = grpc.ServiceDesc{ ServiceName: "com.github.veqryn.awesome.Default", HandlerType: (*DefaultServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Greeting", Handler: _Default_Greeting_Handler, }, { MethodName: "Review", Handler: _Default_Review_Handler, }, { MethodName: "Error", Handler: _Default_Error_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "awesome.proto", }
Default_ServiceDesc is the grpc.ServiceDesc for Default service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_awesome_proto protoreflect.FileDescriptor
Functions ¶
func RegisterDefaultHandler ¶
func RegisterDefaultHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterDefaultHandler registers the http handlers for service Default to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterDefaultHandlerClient ¶
func RegisterDefaultHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DefaultClient) error
RegisterDefaultHandlerClient registers the http handlers for service Default to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DefaultClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DefaultClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DefaultClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterDefaultHandlerFromEndpoint ¶
func RegisterDefaultHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterDefaultHandlerFromEndpoint is same as RegisterDefaultHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDefaultHandlerServer ¶
func RegisterDefaultHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DefaultServer) error
RegisterDefaultHandlerServer registers the http handlers for service Default to "mux". UnaryRPC :call DefaultServer 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 RegisterDefaultHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterDefaultServer ¶
func RegisterDefaultServer(s grpc.ServiceRegistrar, srv DefaultServer)
Types ¶
type DefaultClient ¶
type DefaultClient interface { Greeting(ctx context.Context, in *GreetingReq, opts ...grpc.CallOption) (*GreetingResp, error) Review(ctx context.Context, in *ReviewReq, opts ...grpc.CallOption) (*ReviewResp, error) Error(ctx context.Context, in *ErrorReq, opts ...grpc.CallOption) (*ErrorResp, error) }
DefaultClient is the client API for Default 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.
The service definition.
func NewDefaultClient ¶
func NewDefaultClient(cc grpc.ClientConnInterface) DefaultClient
type DefaultServer ¶
type DefaultServer interface { Greeting(context.Context, *GreetingReq) (*GreetingResp, error) Review(context.Context, *ReviewReq) (*ReviewResp, error) Error(context.Context, *ErrorReq) (*ErrorResp, error) }
DefaultServer is the server API for Default service. All implementations should embed UnimplementedDefaultServer for forward compatibility.
The service definition.
type ErrorReq ¶
type ErrorReq struct {
// contains filtered or unexported fields
}
func (*ErrorReq) Descriptor
deprecated
func (*ErrorReq) ProtoMessage ¶
func (*ErrorReq) ProtoMessage()
func (*ErrorReq) ProtoReflect ¶
func (x *ErrorReq) ProtoReflect() protoreflect.Message
type ErrorResp ¶
type ErrorResp struct {
// contains filtered or unexported fields
}
func (*ErrorResp) Descriptor
deprecated
func (*ErrorResp) ProtoMessage ¶
func (*ErrorResp) ProtoMessage()
func (*ErrorResp) ProtoReflect ¶
func (x *ErrorResp) ProtoReflect() protoreflect.Message
type GreetingReq ¶
type GreetingReq struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*GreetingReq) Descriptor
deprecated
func (*GreetingReq) Descriptor() ([]byte, []int)
Deprecated: Use GreetingReq.ProtoReflect.Descriptor instead.
func (*GreetingReq) GetName ¶
func (x *GreetingReq) GetName() string
func (*GreetingReq) ProtoMessage ¶
func (*GreetingReq) ProtoMessage()
func (*GreetingReq) ProtoReflect ¶
func (x *GreetingReq) ProtoReflect() protoreflect.Message
func (*GreetingReq) Reset ¶
func (x *GreetingReq) Reset()
func (*GreetingReq) String ¶
func (x *GreetingReq) String() string
type GreetingResp ¶
type GreetingResp struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*GreetingResp) Descriptor
deprecated
func (*GreetingResp) Descriptor() ([]byte, []int)
Deprecated: Use GreetingResp.ProtoReflect.Descriptor instead.
func (*GreetingResp) GetMessage ¶
func (x *GreetingResp) GetMessage() string
func (*GreetingResp) ProtoMessage ¶
func (*GreetingResp) ProtoMessage()
func (*GreetingResp) ProtoReflect ¶
func (x *GreetingResp) ProtoReflect() protoreflect.Message
func (*GreetingResp) Reset ¶
func (x *GreetingResp) Reset()
func (*GreetingResp) String ¶
func (x *GreetingResp) String() string
type ReviewReq ¶
type ReviewReq struct { Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"` Rating int64 `protobuf:"varint,3,opt,name=rating,proto3" json:"rating,omitempty"` // contains filtered or unexported fields }
func (*ReviewReq) Descriptor
deprecated
func (*ReviewReq) GetMessage ¶
func (*ReviewReq) ProtoMessage ¶
func (*ReviewReq) ProtoMessage()
func (*ReviewReq) ProtoReflect ¶
func (x *ReviewReq) ProtoReflect() protoreflect.Message
type ReviewResp ¶
type ReviewResp struct {
// contains filtered or unexported fields
}
func (*ReviewResp) Descriptor
deprecated
func (*ReviewResp) Descriptor() ([]byte, []int)
Deprecated: Use ReviewResp.ProtoReflect.Descriptor instead.
func (*ReviewResp) ProtoMessage ¶
func (*ReviewResp) ProtoMessage()
func (*ReviewResp) ProtoReflect ¶
func (x *ReviewResp) ProtoReflect() protoreflect.Message
func (*ReviewResp) Reset ¶
func (x *ReviewResp) Reset()
func (*ReviewResp) String ¶
func (x *ReviewResp) String() string
type UnimplementedDefaultServer ¶
type UnimplementedDefaultServer struct{}
UnimplementedDefaultServer should be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedDefaultServer) Greeting ¶
func (UnimplementedDefaultServer) Greeting(context.Context, *GreetingReq) (*GreetingResp, error)
func (UnimplementedDefaultServer) Review ¶
func (UnimplementedDefaultServer) Review(context.Context, *ReviewReq) (*ReviewResp, error)
type UnsafeDefaultServer ¶
type UnsafeDefaultServer interface {
// contains filtered or unexported methods
}
UnsafeDefaultServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DefaultServer will result in compilation errors.