Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterHelloHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterHelloHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloClient) error
- func RegisterHelloHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterHelloHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloServer) error
- func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer)
- type HelloClient
- type HelloReq
- func (*HelloReq) Descriptor() ([]byte, []int)deprecated
- func (x *HelloReq) GetId() int64
- func (*HelloReq) ProtoMessage()
- func (x *HelloReq) ProtoReflect() protoreflect.Message
- func (x *HelloReq) Reset()
- func (x *HelloReq) String() string
- func (m *HelloReq) Validate() error
- func (m *HelloReq) ValidateAll() error
- type HelloReqMultiError
- type HelloReqValidationError
- type HelloResp
- func (*HelloResp) Descriptor() ([]byte, []int)deprecated
- func (x *HelloResp) GetId() int64
- func (x *HelloResp) GetMessage() string
- func (*HelloResp) ProtoMessage()
- func (x *HelloResp) ProtoReflect() protoreflect.Message
- func (x *HelloResp) Reset()
- func (x *HelloResp) String() string
- func (m *HelloResp) Validate() error
- func (m *HelloResp) ValidateAll() error
- type HelloRespMultiError
- type HelloRespValidationError
- type HelloServer
- type UnimplementedHelloServer
- type UnsafeHelloServer
Constants ¶
This section is empty.
Variables ¶
var File_hello_v1_hello_proto protoreflect.FileDescriptor
var Hello_ServiceDesc = grpc.ServiceDesc{ ServiceName: "demo.api.v1.Hello", HandlerType: (*HelloServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "sayHello", Handler: _Hello_SayHello_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "hello/v1/hello.proto", }
Hello_ServiceDesc is the grpc.ServiceDesc for Hello service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterHelloHandler ¶
RegisterHelloHandler registers the http handlers for service Hello to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterHelloHandlerClient ¶
func RegisterHelloHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloClient) error
RegisterHelloHandlerClient registers the http handlers for service Hello to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HelloClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HelloClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HelloClient" to call the correct interceptors.
func RegisterHelloHandlerFromEndpoint ¶
func RegisterHelloHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterHelloHandlerFromEndpoint is same as RegisterHelloHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterHelloHandlerServer ¶
func RegisterHelloHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloServer) error
RegisterHelloHandlerServer registers the http handlers for service Hello to "mux". UnaryRPC :call HelloServer 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 RegisterHelloHandlerFromEndpoint instead.
func RegisterHelloServer ¶
func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer)
Types ¶
type HelloClient ¶
type HelloClient interface {
SayHello(ctx context.Context, in *HelloReq, opts ...grpc.CallOption) (*HelloResp, error)
}
HelloClient is the client API for Hello 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 NewHelloClient ¶
func NewHelloClient(cc grpc.ClientConnInterface) HelloClient
type HelloReq ¶
type HelloReq struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*HelloReq) Descriptor
deprecated
func (*HelloReq) ProtoMessage ¶
func (*HelloReq) ProtoMessage()
func (*HelloReq) ProtoReflect ¶
func (x *HelloReq) ProtoReflect() protoreflect.Message
func (*HelloReq) Validate ¶
Validate checks the field values on HelloReq with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*HelloReq) ValidateAll ¶
ValidateAll checks the field values on HelloReq with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HelloReqMultiError, or nil if none found.
type HelloReqMultiError ¶
type HelloReqMultiError []error
HelloReqMultiError is an error wrapping multiple validation errors returned by HelloReq.ValidateAll() if the designated constraints aren't met.
func (HelloReqMultiError) AllErrors ¶
func (m HelloReqMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (HelloReqMultiError) Error ¶
func (m HelloReqMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type HelloReqValidationError ¶
type HelloReqValidationError struct {
// contains filtered or unexported fields
}
HelloReqValidationError is the validation error returned by HelloReq.Validate if the designated constraints aren't met.
func (HelloReqValidationError) Cause ¶
func (e HelloReqValidationError) Cause() error
Cause function returns cause value.
func (HelloReqValidationError) Error ¶
func (e HelloReqValidationError) Error() string
Error satisfies the builtin error interface
func (HelloReqValidationError) ErrorName ¶
func (e HelloReqValidationError) ErrorName() string
ErrorName returns error name.
func (HelloReqValidationError) Field ¶
func (e HelloReqValidationError) Field() string
Field function returns field value.
func (HelloReqValidationError) Key ¶
func (e HelloReqValidationError) Key() bool
Key function returns key value.
func (HelloReqValidationError) Reason ¶
func (e HelloReqValidationError) Reason() string
Reason function returns reason value.
type HelloResp ¶
type HelloResp struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*HelloResp) Descriptor
deprecated
func (*HelloResp) GetMessage ¶
func (*HelloResp) ProtoMessage ¶
func (*HelloResp) ProtoMessage()
func (*HelloResp) ProtoReflect ¶
func (x *HelloResp) ProtoReflect() protoreflect.Message
func (*HelloResp) Validate ¶
Validate checks the field values on HelloResp with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*HelloResp) ValidateAll ¶
ValidateAll checks the field values on HelloResp with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HelloRespMultiError, or nil if none found.
type HelloRespMultiError ¶
type HelloRespMultiError []error
HelloRespMultiError is an error wrapping multiple validation errors returned by HelloResp.ValidateAll() if the designated constraints aren't met.
func (HelloRespMultiError) AllErrors ¶
func (m HelloRespMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (HelloRespMultiError) Error ¶
func (m HelloRespMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type HelloRespValidationError ¶
type HelloRespValidationError struct {
// contains filtered or unexported fields
}
HelloRespValidationError is the validation error returned by HelloResp.Validate if the designated constraints aren't met.
func (HelloRespValidationError) Cause ¶
func (e HelloRespValidationError) Cause() error
Cause function returns cause value.
func (HelloRespValidationError) Error ¶
func (e HelloRespValidationError) Error() string
Error satisfies the builtin error interface
func (HelloRespValidationError) ErrorName ¶
func (e HelloRespValidationError) ErrorName() string
ErrorName returns error name.
func (HelloRespValidationError) Field ¶
func (e HelloRespValidationError) Field() string
Field function returns field value.
func (HelloRespValidationError) Key ¶
func (e HelloRespValidationError) Key() bool
Key function returns key value.
func (HelloRespValidationError) Reason ¶
func (e HelloRespValidationError) Reason() string
Reason function returns reason value.
type HelloServer ¶
type HelloServer interface { SayHello(context.Context, *HelloReq) (*HelloResp, error) // contains filtered or unexported methods }
HelloServer is the server API for Hello service. All implementations must embed UnimplementedHelloServer for forward compatibility
type UnimplementedHelloServer ¶
type UnimplementedHelloServer struct { }
UnimplementedHelloServer must be embedded to have forward compatible implementations.
type UnsafeHelloServer ¶
type UnsafeHelloServer interface {
// contains filtered or unexported methods
}
UnsafeHelloServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HelloServer will result in compilation errors.