Documentation ¶
Overview ¶
Package hocon is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterHoconServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterHoconServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HoconServiceClient) error
- func RegisterHoconServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterHoconServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HoconServiceServer) error
- func RegisterHoconServiceServer(s grpc.ServiceRegistrar, srv HoconServiceServer)
- type HoconServiceClient
- type HoconServiceServer
- type LampScene
- type LampStatus
- func (*LampStatus) Descriptor() ([]byte, []int)deprecated
- func (x *LampStatus) GetId() string
- func (x *LampStatus) GetScene() LampScene
- func (*LampStatus) ProtoMessage()
- func (x *LampStatus) ProtoReflect() protoreflect.Message
- func (x *LampStatus) Reset()
- func (x *LampStatus) String() string
- func (m *LampStatus) Validate() error
- func (m *LampStatus) ValidateAll() error
- type LampStatusMultiError
- type LampStatusValidationError
- type UnimplementedHoconServiceServer
- type UnsafeHoconServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( LampScene_name = map[int32]string{ 0: "UNKNOWN", 1: "OFF", 2: "NIGHT", 3: "DAY", } LampScene_value = map[string]int32{ "UNKNOWN": 0, "OFF": 1, "NIGHT": 2, "DAY": 3, } )
Enum value maps for LampScene.
var File_proto_service_proto protoreflect.FileDescriptor
var HoconService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "api.hocon.v1.HoconService", HandlerType: (*HoconServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "LampControl", Handler: _HoconService_LampControl_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/service.proto", }
HoconService_ServiceDesc is the grpc.ServiceDesc for HoconService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterHoconServiceHandler ¶
func RegisterHoconServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterHoconServiceHandler registers the http handlers for service HoconService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterHoconServiceHandlerClient ¶
func RegisterHoconServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HoconServiceClient) error
RegisterHoconServiceHandlerClient registers the http handlers for service HoconService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HoconServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HoconServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HoconServiceClient" to call the correct interceptors.
func RegisterHoconServiceHandlerFromEndpoint ¶
func RegisterHoconServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterHoconServiceHandlerFromEndpoint is same as RegisterHoconServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterHoconServiceHandlerServer ¶
func RegisterHoconServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HoconServiceServer) error
RegisterHoconServiceHandlerServer registers the http handlers for service HoconService to "mux". UnaryRPC :call HoconServiceServer 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 RegisterHoconServiceHandlerFromEndpoint instead.
func RegisterHoconServiceServer ¶
func RegisterHoconServiceServer(s grpc.ServiceRegistrar, srv HoconServiceServer)
Types ¶
type HoconServiceClient ¶
type HoconServiceClient interface { // управление лампочкой LampControl(ctx context.Context, in *LampStatus, opts ...grpc.CallOption) (*LampStatus, error) }
HoconServiceClient is the client API for HoconService 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 NewHoconServiceClient ¶
func NewHoconServiceClient(cc grpc.ClientConnInterface) HoconServiceClient
type HoconServiceServer ¶
type HoconServiceServer interface { // управление лампочкой LampControl(context.Context, *LampStatus) (*LampStatus, error) // contains filtered or unexported methods }
HoconServiceServer is the server API for HoconService service. All implementations must embed UnimplementedHoconServiceServer for forward compatibility
type LampScene ¶
type LampScene int32
Lamp scenes
func (LampScene) Descriptor ¶
func (LampScene) Descriptor() protoreflect.EnumDescriptor
func (LampScene) EnumDescriptor
deprecated
func (LampScene) Number ¶
func (x LampScene) Number() protoreflect.EnumNumber
func (LampScene) Type ¶
func (LampScene) Type() protoreflect.EnumType
type LampStatus ¶
type LampStatus struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Scene LampScene `protobuf:"varint,2,opt,name=scene,proto3,enum=api.hocon.v1.LampScene" json:"scene,omitempty"` // contains filtered or unexported fields }
Lamp status attributes
func (*LampStatus) Descriptor
deprecated
func (*LampStatus) Descriptor() ([]byte, []int)
Deprecated: Use LampStatus.ProtoReflect.Descriptor instead.
func (*LampStatus) GetId ¶
func (x *LampStatus) GetId() string
func (*LampStatus) GetScene ¶
func (x *LampStatus) GetScene() LampScene
func (*LampStatus) ProtoMessage ¶
func (*LampStatus) ProtoMessage()
func (*LampStatus) ProtoReflect ¶
func (x *LampStatus) ProtoReflect() protoreflect.Message
func (*LampStatus) Reset ¶
func (x *LampStatus) Reset()
func (*LampStatus) String ¶
func (x *LampStatus) String() string
func (*LampStatus) Validate ¶
func (m *LampStatus) Validate() error
Validate checks the field values on LampStatus 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 (*LampStatus) ValidateAll ¶
func (m *LampStatus) ValidateAll() error
ValidateAll checks the field values on LampStatus 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 LampStatusMultiError, or nil if none found.
type LampStatusMultiError ¶
type LampStatusMultiError []error
LampStatusMultiError is an error wrapping multiple validation errors returned by LampStatus.ValidateAll() if the designated constraints aren't met.
func (LampStatusMultiError) AllErrors ¶
func (m LampStatusMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (LampStatusMultiError) Error ¶
func (m LampStatusMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type LampStatusValidationError ¶
type LampStatusValidationError struct {
// contains filtered or unexported fields
}
LampStatusValidationError is the validation error returned by LampStatus.Validate if the designated constraints aren't met.
func (LampStatusValidationError) Cause ¶
func (e LampStatusValidationError) Cause() error
Cause function returns cause value.
func (LampStatusValidationError) Error ¶
func (e LampStatusValidationError) Error() string
Error satisfies the builtin error interface
func (LampStatusValidationError) ErrorName ¶
func (e LampStatusValidationError) ErrorName() string
ErrorName returns error name.
func (LampStatusValidationError) Field ¶
func (e LampStatusValidationError) Field() string
Field function returns field value.
func (LampStatusValidationError) Key ¶
func (e LampStatusValidationError) Key() bool
Key function returns key value.
func (LampStatusValidationError) Reason ¶
func (e LampStatusValidationError) Reason() string
Reason function returns reason value.
type UnimplementedHoconServiceServer ¶
type UnimplementedHoconServiceServer struct { }
UnimplementedHoconServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedHoconServiceServer) LampControl ¶
func (UnimplementedHoconServiceServer) LampControl(context.Context, *LampStatus) (*LampStatus, error)
type UnsafeHoconServiceServer ¶
type UnsafeHoconServiceServer interface {
// contains filtered or unexported methods
}
UnsafeHoconServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HoconServiceServer will result in compilation errors.