Documentation ¶
Overview ¶
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterSayHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterSayHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SayClient) error
- func RegisterSayHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterSayHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SayServer) error
- func RegisterSayServer(s *grpc.Server, srv SayServer)
- type Data
- type DataValidationError
- type Request
- type RequestValidationError
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetIsSuccess() bool
- func (x *Response) GetMsg() string
- func (x *Response) GetType() Type
- 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 SayClient
- type SayServer
- type Type
- type UnimplementedSayServer
- type UnsafeSayServer
Constants ¶
This section is empty.
Variables ¶
var ( Type_name = map[int32]string{ 0: "UNIVERSAL", 1: "WEB", 2: "IMAGES", 3: "LOCAL", } Type_value = map[string]int32{ "UNIVERSAL": 0, "WEB": 1, "IMAGES": 2, "LOCAL": 3, } )
Enum value maps for Type.
var File_main_proto protoreflect.FileDescriptor
Functions ¶
func RegisterSayHandler ¶
RegisterSayHandler registers the http handlers for service Say to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterSayHandlerClient ¶
RegisterSayHandlerClient registers the http handlers for service Say to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SayClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SayClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SayClient" to call the correct interceptors.
func RegisterSayHandlerFromEndpoint ¶
func RegisterSayHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterSayHandlerFromEndpoint is same as RegisterSayHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSayHandlerServer ¶
RegisterSayHandlerServer registers the http handlers for service Say to "mux". UnaryRPC :call SayServer 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 RegisterSayHandlerFromEndpoint instead.
func RegisterSayServer ¶
Types ¶
type Data ¶
type Data struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*Data) Descriptor
deprecated
func (*Data) ProtoMessage ¶
func (*Data) ProtoMessage()
func (*Data) ProtoReflect ¶
func (x *Data) ProtoReflect() protoreflect.Message
type DataValidationError ¶ added in v1.5.2
type DataValidationError struct {
// contains filtered or unexported fields
}
DataValidationError is the validation error returned by Data.Validate if the designated constraints aren't met.
func (DataValidationError) Cause ¶ added in v1.5.2
func (e DataValidationError) Cause() error
Cause function returns cause value.
func (DataValidationError) Error ¶ added in v1.5.2
func (e DataValidationError) Error() string
Error satisfies the builtin error interface
func (DataValidationError) ErrorName ¶ added in v1.5.2
func (e DataValidationError) ErrorName() string
ErrorName returns error name.
func (DataValidationError) Field ¶ added in v1.5.2
func (e DataValidationError) Field() string
Field function returns field value.
func (DataValidationError) Key ¶ added in v1.5.2
func (e DataValidationError) Key() bool
Key function returns key value.
func (DataValidationError) Reason ¶ added in v1.5.2
func (e DataValidationError) Reason() string
Reason function returns reason value.
type Request ¶
type Request struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,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 RequestValidationError ¶ added in v1.5.2
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 ¶ added in v1.5.2
func (e RequestValidationError) Cause() error
Cause function returns cause value.
func (RequestValidationError) Error ¶ added in v1.5.2
func (e RequestValidationError) Error() string
Error satisfies the builtin error interface
func (RequestValidationError) ErrorName ¶ added in v1.5.2
func (e RequestValidationError) ErrorName() string
ErrorName returns error name.
func (RequestValidationError) Field ¶ added in v1.5.2
func (e RequestValidationError) Field() string
Field function returns field value.
func (RequestValidationError) Key ¶ added in v1.5.2
func (e RequestValidationError) Key() bool
Key function returns key value.
func (RequestValidationError) Reason ¶ added in v1.5.2
func (e RequestValidationError) Reason() string
Reason function returns reason value.
type Response ¶
type Response struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` Type Type `protobuf:"varint,2,opt,name=type,proto3,enum=pb.Type" json:"type,omitempty"` IsSuccess bool `protobuf:"varint,3,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) GetIsSuccess ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type ResponseValidationError ¶ added in v1.5.2
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 ¶ added in v1.5.2
func (e ResponseValidationError) Cause() error
Cause function returns cause value.
func (ResponseValidationError) Error ¶ added in v1.5.2
func (e ResponseValidationError) Error() string
Error satisfies the builtin error interface
func (ResponseValidationError) ErrorName ¶ added in v1.5.2
func (e ResponseValidationError) ErrorName() string
ErrorName returns error name.
func (ResponseValidationError) Field ¶ added in v1.5.2
func (e ResponseValidationError) Field() string
Field function returns field value.
func (ResponseValidationError) Key ¶ added in v1.5.2
func (e ResponseValidationError) Key() bool
Key function returns key value.
func (ResponseValidationError) Reason ¶ added in v1.5.2
func (e ResponseValidationError) Reason() string
Reason function returns reason value.
type SayClient ¶
type SayClient interface { Hello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) Errors(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) Any(ctx context.Context, in *Data, opts ...grpc.CallOption) (*Data, error) }
SayClient is the client API for Say 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 NewSayClient ¶
func NewSayClient(cc grpc.ClientConnInterface) SayClient
type SayServer ¶
type SayServer interface { Hello(context.Context, *Request) (*Response, error) Errors(context.Context, *empty.Empty) (*empty.Empty, error) Any(context.Context, *Data) (*Data, error) // contains filtered or unexported methods }
SayServer is the server API for Say service. All implementations must embed UnimplementedSayServer for forward compatibility
type Type ¶
type Type int32
func (Type) Descriptor ¶
func (Type) Descriptor() protoreflect.EnumDescriptor
func (Type) EnumDescriptor
deprecated
func (Type) Number ¶
func (x Type) Number() protoreflect.EnumNumber
func (Type) Type ¶
func (Type) Type() protoreflect.EnumType
type UnimplementedSayServer ¶
type UnimplementedSayServer struct { }
UnimplementedSayServer must be embedded to have forward compatible implementations.
type UnsafeSayServer ¶ added in v1.5.2
type UnsafeSayServer interface {
// contains filtered or unexported methods
}
UnsafeSayServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SayServer will result in compilation errors.