Documentation ¶
Overview ¶
Package picture is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterPictureHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterPictureHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PictureClient) error
- func RegisterPictureHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterPictureHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PictureServer) error
- func RegisterPictureServer(s grpc.ServiceRegistrar, srv PictureServer)
- type BackgroundRequest
- func (*BackgroundRequest) Descriptor() ([]byte, []int)deprecated
- func (x *BackgroundRequest) GetRandom() bool
- func (*BackgroundRequest) ProtoMessage()
- func (x *BackgroundRequest) ProtoReflect() protoreflect.Message
- func (x *BackgroundRequest) Reset()
- func (x *BackgroundRequest) String() string
- func (m *BackgroundRequest) Validate() error
- func (m *BackgroundRequest) ValidateAll() error
- type BackgroundRequestMultiError
- type BackgroundRequestValidationError
- func (e BackgroundRequestValidationError) Cause() error
- func (e BackgroundRequestValidationError) Error() string
- func (e BackgroundRequestValidationError) ErrorName() string
- func (e BackgroundRequestValidationError) Field() string
- func (e BackgroundRequestValidationError) Key() bool
- func (e BackgroundRequestValidationError) Reason() string
- type BackgroundResponse
- func (*BackgroundResponse) Descriptor() ([]byte, []int)deprecated
- func (x *BackgroundResponse) GetCopyright() string
- func (x *BackgroundResponse) GetUrl() string
- func (*BackgroundResponse) ProtoMessage()
- func (x *BackgroundResponse) ProtoReflect() protoreflect.Message
- func (x *BackgroundResponse) Reset()
- func (x *BackgroundResponse) String() string
- func (m *BackgroundResponse) Validate() error
- func (m *BackgroundResponse) ValidateAll() error
- type BackgroundResponseMultiError
- type BackgroundResponseValidationError
- func (e BackgroundResponseValidationError) Cause() error
- func (e BackgroundResponseValidationError) Error() string
- func (e BackgroundResponseValidationError) ErrorName() string
- func (e BackgroundResponseValidationError) Field() string
- func (e BackgroundResponseValidationError) Key() bool
- func (e BackgroundResponseValidationError) Reason() string
- type PictureClient
- type PictureServer
- type UnimplementedPictureServer
- type UnsafePictureServer
Constants ¶
const (
Picture_Background_FullMethodName = "/picture.Picture/Background"
)
Variables ¶
var File_picture_picture_proto protoreflect.FileDescriptor
var Picture_ServiceDesc = grpc.ServiceDesc{ ServiceName: "picture.Picture", HandlerType: (*PictureServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Background", Handler: _Picture_Background_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "picture/picture.proto", }
Picture_ServiceDesc is the grpc.ServiceDesc for Picture service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterPictureHandler ¶
func RegisterPictureHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterPictureHandler registers the http handlers for service Picture to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterPictureHandlerClient ¶
func RegisterPictureHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PictureClient) error
RegisterPictureHandlerClient registers the http handlers for service Picture to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PictureClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PictureClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PictureClient" to call the correct interceptors.
func RegisterPictureHandlerFromEndpoint ¶
func RegisterPictureHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterPictureHandlerFromEndpoint is same as RegisterPictureHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPictureHandlerServer ¶
func RegisterPictureHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PictureServer) error
RegisterPictureHandlerServer registers the http handlers for service Picture to "mux". UnaryRPC :call PictureServer 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 RegisterPictureHandlerFromEndpoint instead.
func RegisterPictureServer ¶
func RegisterPictureServer(s grpc.ServiceRegistrar, srv PictureServer)
Types ¶
type BackgroundRequest ¶
type BackgroundRequest struct { Random bool `protobuf:"varint,1,opt,name=random,proto3" json:"random,omitempty"` // contains filtered or unexported fields }
func (*BackgroundRequest) Descriptor
deprecated
func (*BackgroundRequest) Descriptor() ([]byte, []int)
Deprecated: Use BackgroundRequest.ProtoReflect.Descriptor instead.
func (*BackgroundRequest) GetRandom ¶
func (x *BackgroundRequest) GetRandom() bool
func (*BackgroundRequest) ProtoMessage ¶
func (*BackgroundRequest) ProtoMessage()
func (*BackgroundRequest) ProtoReflect ¶
func (x *BackgroundRequest) ProtoReflect() protoreflect.Message
func (*BackgroundRequest) Reset ¶
func (x *BackgroundRequest) Reset()
func (*BackgroundRequest) String ¶
func (x *BackgroundRequest) String() string
func (*BackgroundRequest) Validate ¶
func (m *BackgroundRequest) Validate() error
Validate checks the field values on BackgroundRequest 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 (*BackgroundRequest) ValidateAll ¶
func (m *BackgroundRequest) ValidateAll() error
ValidateAll checks the field values on BackgroundRequest 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 BackgroundRequestMultiError, or nil if none found.
type BackgroundRequestMultiError ¶
type BackgroundRequestMultiError []error
BackgroundRequestMultiError is an error wrapping multiple validation errors returned by BackgroundRequest.ValidateAll() if the designated constraints aren't met.
func (BackgroundRequestMultiError) AllErrors ¶
func (m BackgroundRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (BackgroundRequestMultiError) Error ¶
func (m BackgroundRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type BackgroundRequestValidationError ¶
type BackgroundRequestValidationError struct {
// contains filtered or unexported fields
}
BackgroundRequestValidationError is the validation error returned by BackgroundRequest.Validate if the designated constraints aren't met.
func (BackgroundRequestValidationError) Cause ¶
func (e BackgroundRequestValidationError) Cause() error
Cause function returns cause value.
func (BackgroundRequestValidationError) Error ¶
func (e BackgroundRequestValidationError) Error() string
Error satisfies the builtin error interface
func (BackgroundRequestValidationError) ErrorName ¶
func (e BackgroundRequestValidationError) ErrorName() string
ErrorName returns error name.
func (BackgroundRequestValidationError) Field ¶
func (e BackgroundRequestValidationError) Field() string
Field function returns field value.
func (BackgroundRequestValidationError) Key ¶
func (e BackgroundRequestValidationError) Key() bool
Key function returns key value.
func (BackgroundRequestValidationError) Reason ¶
func (e BackgroundRequestValidationError) Reason() string
Reason function returns reason value.
type BackgroundResponse ¶
type BackgroundResponse struct { Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` Copyright string `protobuf:"bytes,2,opt,name=copyright,proto3" json:"copyright,omitempty"` // contains filtered or unexported fields }
func (*BackgroundResponse) Descriptor
deprecated
func (*BackgroundResponse) Descriptor() ([]byte, []int)
Deprecated: Use BackgroundResponse.ProtoReflect.Descriptor instead.
func (*BackgroundResponse) GetCopyright ¶
func (x *BackgroundResponse) GetCopyright() string
func (*BackgroundResponse) GetUrl ¶
func (x *BackgroundResponse) GetUrl() string
func (*BackgroundResponse) ProtoMessage ¶
func (*BackgroundResponse) ProtoMessage()
func (*BackgroundResponse) ProtoReflect ¶
func (x *BackgroundResponse) ProtoReflect() protoreflect.Message
func (*BackgroundResponse) Reset ¶
func (x *BackgroundResponse) Reset()
func (*BackgroundResponse) String ¶
func (x *BackgroundResponse) String() string
func (*BackgroundResponse) Validate ¶
func (m *BackgroundResponse) Validate() error
Validate checks the field values on BackgroundResponse 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 (*BackgroundResponse) ValidateAll ¶
func (m *BackgroundResponse) ValidateAll() error
ValidateAll checks the field values on BackgroundResponse 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 BackgroundResponseMultiError, or nil if none found.
type BackgroundResponseMultiError ¶
type BackgroundResponseMultiError []error
BackgroundResponseMultiError is an error wrapping multiple validation errors returned by BackgroundResponse.ValidateAll() if the designated constraints aren't met.
func (BackgroundResponseMultiError) AllErrors ¶
func (m BackgroundResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (BackgroundResponseMultiError) Error ¶
func (m BackgroundResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type BackgroundResponseValidationError ¶
type BackgroundResponseValidationError struct {
// contains filtered or unexported fields
}
BackgroundResponseValidationError is the validation error returned by BackgroundResponse.Validate if the designated constraints aren't met.
func (BackgroundResponseValidationError) Cause ¶
func (e BackgroundResponseValidationError) Cause() error
Cause function returns cause value.
func (BackgroundResponseValidationError) Error ¶
func (e BackgroundResponseValidationError) Error() string
Error satisfies the builtin error interface
func (BackgroundResponseValidationError) ErrorName ¶
func (e BackgroundResponseValidationError) ErrorName() string
ErrorName returns error name.
func (BackgroundResponseValidationError) Field ¶
func (e BackgroundResponseValidationError) Field() string
Field function returns field value.
func (BackgroundResponseValidationError) Key ¶
func (e BackgroundResponseValidationError) Key() bool
Key function returns key value.
func (BackgroundResponseValidationError) Reason ¶
func (e BackgroundResponseValidationError) Reason() string
Reason function returns reason value.
type PictureClient ¶
type PictureClient interface { // Background 获取背景图片 Background(ctx context.Context, in *BackgroundRequest, opts ...grpc.CallOption) (*BackgroundResponse, error) }
PictureClient is the client API for Picture 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 NewPictureClient ¶
func NewPictureClient(cc grpc.ClientConnInterface) PictureClient
type PictureServer ¶
type PictureServer interface { // Background 获取背景图片 Background(context.Context, *BackgroundRequest) (*BackgroundResponse, error) // contains filtered or unexported methods }
PictureServer is the server API for Picture service. All implementations must embed UnimplementedPictureServer for forward compatibility
type UnimplementedPictureServer ¶
type UnimplementedPictureServer struct { }
UnimplementedPictureServer must be embedded to have forward compatible implementations.
func (UnimplementedPictureServer) Background ¶
func (UnimplementedPictureServer) Background(context.Context, *BackgroundRequest) (*BackgroundResponse, error)
type UnsafePictureServer ¶
type UnsafePictureServer interface {
// contains filtered or unexported methods
}
UnsafePictureServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PictureServer will result in compilation errors.