hocon

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package hocon is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var File_proto_service_proto protoreflect.FileDescriptor
View Source
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.

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

const (
	// A Standard tournament
	LampScene_UNKNOWN LampScene = 0
	// Item is off
	LampScene_OFF LampScene = 1
	// Item is in night mode
	LampScene_NIGHT LampScene = 2
	// Item is in day mode
	LampScene_DAY LampScene = 3
)

func (LampScene) Descriptor

func (LampScene) Descriptor() protoreflect.EnumDescriptor

func (LampScene) Enum

func (x LampScene) Enum() *LampScene

func (LampScene) EnumDescriptor deprecated

func (LampScene) EnumDescriptor() ([]byte, []int)

Deprecated: Use LampScene.Descriptor instead.

func (LampScene) Number

func (x LampScene) Number() protoreflect.EnumNumber

func (LampScene) String

func (x LampScene) String() string

func (LampScene) Type

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

Error satisfies the builtin error interface

func (LampStatusValidationError) ErrorName

func (e LampStatusValidationError) ErrorName() string

ErrorName returns error name.

func (LampStatusValidationError) Field

Field function returns field value.

func (LampStatusValidationError) Key

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL