v1

package
v0.0.0-...-48bb83e Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_service_greeting_v1_service_proto protoreflect.FileDescriptor
View Source
var GreetingService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pkg.service.greeting.v1.GreetingService",
	HandlerType: (*GreetingServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SendMessage",
			Handler:    _GreetingService_SendMessage_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/service/greeting/v1/service.proto",
}

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

Functions

func RegisterGreetingServiceHandler

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

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

func RegisterGreetingServiceHandlerClient

func RegisterGreetingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreetingServiceClient) error

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

func RegisterGreetingServiceHandlerFromEndpoint

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

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

func RegisterGreetingServiceHandlerServer

func RegisterGreetingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreetingServiceServer) error

RegisterGreetingServiceHandlerServer registers the http handlers for service GreetingService to "mux". UnaryRPC :call GreetingServiceServer 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 RegisterGreetingServiceHandlerFromEndpoint instead.

func RegisterGreetingServiceServer

func RegisterGreetingServiceServer(s grpc.ServiceRegistrar, srv GreetingServiceServer)

Types

type GreetingServiceClient

type GreetingServiceClient interface {
	SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error)
}

GreetingServiceClient is the client API for GreetingService 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 GreetingServiceServer

type GreetingServiceServer interface {
	SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error)
	// contains filtered or unexported methods
}

GreetingServiceServer is the server API for GreetingService service. All implementations must embed UnimplementedGreetingServiceServer for forward compatibility

type SendMessageRequest

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

func (*SendMessageRequest) Descriptor deprecated

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

Deprecated: Use SendMessageRequest.ProtoReflect.Descriptor instead.

func (*SendMessageRequest) GetContent

func (x *SendMessageRequest) GetContent() string

func (*SendMessageRequest) ProtoMessage

func (*SendMessageRequest) ProtoMessage()

func (*SendMessageRequest) ProtoReflect

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

func (*SendMessageRequest) Reset

func (x *SendMessageRequest) Reset()

func (*SendMessageRequest) String

func (x *SendMessageRequest) String() string

func (*SendMessageRequest) Validate

func (m *SendMessageRequest) Validate() error

Validate checks the field values on SendMessageRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type SendMessageRequestValidationError

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

SendMessageRequestValidationError is the validation error returned by SendMessageRequest.Validate if the designated constraints aren't met.

func (SendMessageRequestValidationError) Cause

Cause function returns cause value.

func (SendMessageRequestValidationError) Error

Error satisfies the builtin error interface

func (SendMessageRequestValidationError) ErrorName

ErrorName returns error name.

func (SendMessageRequestValidationError) Field

Field function returns field value.

func (SendMessageRequestValidationError) Key

Key function returns key value.

func (SendMessageRequestValidationError) Reason

Reason function returns reason value.

type SendMessageResponse

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

func (*SendMessageResponse) Descriptor deprecated

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

Deprecated: Use SendMessageResponse.ProtoReflect.Descriptor instead.

func (*SendMessageResponse) ProtoMessage

func (*SendMessageResponse) ProtoMessage()

func (*SendMessageResponse) ProtoReflect

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

func (*SendMessageResponse) Reset

func (x *SendMessageResponse) Reset()

func (*SendMessageResponse) String

func (x *SendMessageResponse) String() string

func (*SendMessageResponse) Validate

func (m *SendMessageResponse) Validate() error

Validate checks the field values on SendMessageResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type SendMessageResponseValidationError

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

SendMessageResponseValidationError is the validation error returned by SendMessageResponse.Validate if the designated constraints aren't met.

func (SendMessageResponseValidationError) Cause

Cause function returns cause value.

func (SendMessageResponseValidationError) Error

Error satisfies the builtin error interface

func (SendMessageResponseValidationError) ErrorName

ErrorName returns error name.

func (SendMessageResponseValidationError) Field

Field function returns field value.

func (SendMessageResponseValidationError) Key

Key function returns key value.

func (SendMessageResponseValidationError) Reason

Reason function returns reason value.

type UnimplementedGreetingServiceServer

type UnimplementedGreetingServiceServer struct {
}

UnimplementedGreetingServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedGreetingServiceServer) SendMessage

type UnsafeGreetingServiceServer

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

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

Jump to

Keyboard shortcuts

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