Documentation ¶
Overview ¶
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterServerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServerClient) error
- func RegisterServerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterServerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServerServer) error
- func RegisterServerServer(s *grpc.Server, srv ServerServer)
- type Request
- func (*Request) Descriptor() ([]byte, []int)deprecated
- func (x *Request) GetCode() int32
- func (x *Request) GetMessage() string
- func (x *Request) GetMeta() map[string]string
- func (x *Request) GetType() string
- func (*Request) ProtoMessage()
- func (x *Request) ProtoReflect() protoreflect.Message
- func (x *Request) Reset()
- func (x *Request) String() string
- func (m *Request) Validate() error
- type RequestValidationError
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetData() map[string]*Response_List
- func (x *Response) GetRequest() *Request
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- func (m *Response) Validate() error
- type ResponseValidationError
- type Response_List
- func (*Response_List) Descriptor() ([]byte, []int)deprecated
- func (x *Response_List) GetList() []string
- func (*Response_List) ProtoMessage()
- func (x *Response_List) ProtoReflect() protoreflect.Message
- func (x *Response_List) Reset()
- func (x *Response_List) String() string
- func (m *Response_List) Validate() error
- type Response_ListValidationError
- func (e Response_ListValidationError) Cause() error
- func (e Response_ListValidationError) Error() string
- func (e Response_ListValidationError) ErrorName() string
- func (e Response_ListValidationError) Field() string
- func (e Response_ListValidationError) Key() bool
- func (e Response_ListValidationError) Reason() string
- type ServerClient
- type ServerServer
- type UnimplementedServerServer
- type UnsafeServerServer
Constants ¶
This section is empty.
Variables ¶
var File_server_proto protoreflect.FileDescriptor
Functions ¶
func RegisterServerHandler ¶
RegisterServerHandler registers the http handlers for service Server to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterServerHandlerClient ¶
func RegisterServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServerClient) error
RegisterServerHandlerClient registers the http handlers for service Server to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServerClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServerClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ServerClient" to call the correct interceptors.
func RegisterServerHandlerFromEndpoint ¶
func RegisterServerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterServerHandlerFromEndpoint is same as RegisterServerHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterServerHandlerServer ¶
func RegisterServerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServerServer) error
RegisterServerHandlerServer registers the http handlers for service Server to "mux". UnaryRPC :call ServerServer 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 RegisterServerHandlerFromEndpoint instead.
func RegisterServerServer ¶
func RegisterServerServer(s *grpc.Server, srv ServerServer)
Types ¶
type Request ¶
type Request struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` Meta map[string]string `` /* 149-byte string literal not displayed */ Code int32 `protobuf:"varint,4,opt,name=code,proto3" json:"code,omitempty"` // contains filtered or unexported fields }
The parameters to Server.Info.
func (*Request) Descriptor
deprecated
func (*Request) GetMessage ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type RequestValidationError ¶
type RequestValidationError struct {
// contains filtered or unexported fields
}
RequestValidationError is the validation error returned by Request.Validate if the designated constraints aren't met.
func (RequestValidationError) Cause ¶
func (e RequestValidationError) Cause() error
Cause function returns cause value.
func (RequestValidationError) Error ¶
func (e RequestValidationError) Error() string
Error satisfies the builtin error interface
func (RequestValidationError) ErrorName ¶
func (e RequestValidationError) ErrorName() string
ErrorName returns error name.
func (RequestValidationError) Field ¶
func (e RequestValidationError) Field() string
Field function returns field value.
func (RequestValidationError) Key ¶
func (e RequestValidationError) Key() bool
Key function returns key value.
func (RequestValidationError) Reason ¶
func (e RequestValidationError) Reason() string
Reason function returns reason value.
type Response ¶
type Response struct { Request *Request `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` Data map[string]*Response_List `` /* 149-byte string literal not displayed */ // contains filtered or unexported fields }
The Response to Server.Info.
func (*Response) Descriptor
deprecated
func (*Response) GetData ¶
func (x *Response) GetData() map[string]*Response_List
func (*Response) GetRequest ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type ResponseValidationError ¶
type ResponseValidationError struct {
// contains filtered or unexported fields
}
ResponseValidationError is the validation error returned by Response.Validate if the designated constraints aren't met.
func (ResponseValidationError) Cause ¶
func (e ResponseValidationError) Cause() error
Cause function returns cause value.
func (ResponseValidationError) Error ¶
func (e ResponseValidationError) Error() string
Error satisfies the builtin error interface
func (ResponseValidationError) ErrorName ¶
func (e ResponseValidationError) ErrorName() string
ErrorName returns error name.
func (ResponseValidationError) Field ¶
func (e ResponseValidationError) Field() string
Field function returns field value.
func (ResponseValidationError) Key ¶
func (e ResponseValidationError) Key() bool
Key function returns key value.
func (ResponseValidationError) Reason ¶
func (e ResponseValidationError) Reason() string
Reason function returns reason value.
type Response_List ¶
type Response_List struct { List []string `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` // contains filtered or unexported fields }
func (*Response_List) Descriptor
deprecated
func (*Response_List) Descriptor() ([]byte, []int)
Deprecated: Use Response_List.ProtoReflect.Descriptor instead.
func (*Response_List) GetList ¶
func (x *Response_List) GetList() []string
func (*Response_List) ProtoMessage ¶
func (*Response_List) ProtoMessage()
func (*Response_List) ProtoReflect ¶
func (x *Response_List) ProtoReflect() protoreflect.Message
func (*Response_List) Reset ¶
func (x *Response_List) Reset()
func (*Response_List) String ¶
func (x *Response_List) String() string
func (*Response_List) Validate ¶
func (m *Response_List) Validate() error
Validate checks the field values on Response_List with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
type Response_ListValidationError ¶
type Response_ListValidationError struct {
// contains filtered or unexported fields
}
Response_ListValidationError is the validation error returned by Response_List.Validate if the designated constraints aren't met.
func (Response_ListValidationError) Cause ¶
func (e Response_ListValidationError) Cause() error
Cause function returns cause value.
func (Response_ListValidationError) Error ¶
func (e Response_ListValidationError) Error() string
Error satisfies the builtin error interface
func (Response_ListValidationError) ErrorName ¶
func (e Response_ListValidationError) ErrorName() string
ErrorName returns error name.
func (Response_ListValidationError) Field ¶
func (e Response_ListValidationError) Field() string
Field function returns field value.
func (Response_ListValidationError) Key ¶
func (e Response_ListValidationError) Key() bool
Key function returns key value.
func (Response_ListValidationError) Reason ¶
func (e Response_ListValidationError) Reason() string
Reason function returns reason value.
type ServerClient ¶
type ServerClient interface { // Get grpc request infos Info(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) // Post Post(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) }
ServerClient is the client API for Server 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 NewServerClient ¶
func NewServerClient(cc grpc.ClientConnInterface) ServerClient
type ServerServer ¶
type ServerServer interface { // Get grpc request infos Info(context.Context, *Request) (*Response, error) // Post Post(context.Context, *Request) (*Response, error) // contains filtered or unexported methods }
ServerServer is the server API for Server service. All implementations must embed UnimplementedServerServer for forward compatibility
type UnimplementedServerServer ¶
type UnimplementedServerServer struct { }
UnimplementedServerServer must be embedded to have forward compatible implementations.
type UnsafeServerServer ¶
type UnsafeServerServer interface {
// contains filtered or unexported methods
}
UnsafeServerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServerServer will result in compilation errors.