echov1

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package echov1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EchoService_Echo_FullMethodName = "/echo.v1.EchoService/Echo"
)

Variables

View Source
var EchoService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "echo.v1.EchoService",
	HandlerType: (*EchoServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Echo",
			Handler:    _EchoService_Echo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "echo/echo.proto",
}

EchoService_ServiceDesc is the grpc.ServiceDesc for EchoService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_echo_echo_proto protoreflect.FileDescriptor

Functions

func RegisterEchoServiceHandler

func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterEchoServiceHandlerClient

func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error

RegisterEchoServiceHandlerClient registers the http handlers for service EchoService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EchoServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EchoServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "EchoServiceClient" to call the correct interceptors.

func RegisterEchoServiceHandlerFromEndpoint

func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterEchoServiceHandlerServer

func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error

RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". UnaryRPC :call EchoServiceServer 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 RegisterEchoServiceHandlerFromEndpoint instead.

func RegisterEchoServiceServer

func RegisterEchoServiceServer(s grpc.ServiceRegistrar, srv EchoServiceServer)

Types

type EchoRequest

type EchoRequest struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoRequest) Descriptor deprecated

func (*EchoRequest) Descriptor() ([]byte, []int)

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetMessage

func (x *EchoRequest) GetMessage() string

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

func (x *EchoRequest) ProtoReflect() protoreflect.Message

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

func (*EchoRequest) Validate

func (m *EchoRequest) Validate() error

Validate checks the field values on EchoRequest 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 (*EchoRequest) ValidateAll

func (m *EchoRequest) ValidateAll() error

ValidateAll checks the field values on EchoRequest 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 EchoRequestMultiError, or nil if none found.

type EchoRequestMultiError

type EchoRequestMultiError []error

EchoRequestMultiError is an error wrapping multiple validation errors returned by EchoRequest.ValidateAll() if the designated constraints aren't met.

func (EchoRequestMultiError) AllErrors

func (m EchoRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EchoRequestMultiError) Error

func (m EchoRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EchoRequestValidationError

type EchoRequestValidationError struct {
	// contains filtered or unexported fields
}

EchoRequestValidationError is the validation error returned by EchoRequest.Validate if the designated constraints aren't met.

func (EchoRequestValidationError) Cause

Cause function returns cause value.

func (EchoRequestValidationError) Error

Error satisfies the builtin error interface

func (EchoRequestValidationError) ErrorName

func (e EchoRequestValidationError) ErrorName() string

ErrorName returns error name.

func (EchoRequestValidationError) Field

Field function returns field value.

func (EchoRequestValidationError) Key

Key function returns key value.

func (EchoRequestValidationError) Reason

Reason function returns reason value.

type EchoResponse

type EchoResponse struct {
	Message        string            `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	ClientMetadata map[string]string `` /* 191-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*EchoResponse) Descriptor deprecated

func (*EchoResponse) Descriptor() ([]byte, []int)

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetClientMetadata

func (x *EchoResponse) GetClientMetadata() map[string]string

func (*EchoResponse) GetMessage

func (x *EchoResponse) GetMessage() string

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect

func (x *EchoResponse) ProtoReflect() protoreflect.Message

func (*EchoResponse) Reset

func (x *EchoResponse) Reset()

func (*EchoResponse) String

func (x *EchoResponse) String() string

func (*EchoResponse) Validate

func (m *EchoResponse) Validate() error

Validate checks the field values on EchoResponse 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 (*EchoResponse) ValidateAll

func (m *EchoResponse) ValidateAll() error

ValidateAll checks the field values on EchoResponse 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 EchoResponseMultiError, or nil if none found.

type EchoResponseMultiError

type EchoResponseMultiError []error

EchoResponseMultiError is an error wrapping multiple validation errors returned by EchoResponse.ValidateAll() if the designated constraints aren't met.

func (EchoResponseMultiError) AllErrors

func (m EchoResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EchoResponseMultiError) Error

func (m EchoResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EchoResponseValidationError

type EchoResponseValidationError struct {
	// contains filtered or unexported fields
}

EchoResponseValidationError is the validation error returned by EchoResponse.Validate if the designated constraints aren't met.

func (EchoResponseValidationError) Cause

Cause function returns cause value.

func (EchoResponseValidationError) Error

Error satisfies the builtin error interface

func (EchoResponseValidationError) ErrorName

func (e EchoResponseValidationError) ErrorName() string

ErrorName returns error name.

func (EchoResponseValidationError) Field

Field function returns field value.

func (EchoResponseValidationError) Key

Key function returns key value.

func (EchoResponseValidationError) Reason

Reason function returns reason value.

type EchoServiceClient

type EchoServiceClient interface {
	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
}

EchoServiceClient is the client API for EchoService 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 EchoServiceServer

type EchoServiceServer interface {
	Echo(context.Context, *EchoRequest) (*EchoResponse, error)
	// contains filtered or unexported methods
}

EchoServiceServer is the server API for EchoService service. All implementations must embed UnimplementedEchoServiceServer for forward compatibility

type UnimplementedEchoServiceServer

type UnimplementedEchoServiceServer struct {
}

UnimplementedEchoServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedEchoServiceServer) Echo

type UnsafeEchoServiceServer

type UnsafeEchoServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeEchoServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EchoServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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