servicev1

package
v0.0.0-...-c3390c3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package servicev1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_service_v1_service_proto protoreflect.FileDescriptor
View Source
var MessageAPIService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "service.v1.MessageAPIService",
	HandlerType: (*MessageAPIServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Echo",
			Handler:    _MessageAPIService_Echo_Handler,
		},
		{
			MethodName: "Reverse",
			Handler:    _MessageAPIService_Reverse_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service/v1/service.proto",
}

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

Functions

func RegisterMessageAPIServiceHandler

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

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

func RegisterMessageAPIServiceHandlerClient

func RegisterMessageAPIServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MessageAPIServiceClient) error

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

func RegisterMessageAPIServiceHandlerFromEndpoint

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

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

func RegisterMessageAPIServiceHandlerServer

func RegisterMessageAPIServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MessageAPIServiceServer) error

RegisterMessageAPIServiceHandlerServer registers the http handlers for service MessageAPIService to "mux". UnaryRPC :call MessageAPIServiceServer 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 RegisterMessageAPIServiceHandlerFromEndpoint instead.

func RegisterMessageAPIServiceServer

func RegisterMessageAPIServiceServer(s grpc.ServiceRegistrar, srv MessageAPIServiceServer)

Types

type EchoRequest

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

func (*EchoRequest) Descriptor deprecated

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

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetValue

func (x *EchoRequest) GetValue() 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

type EchoResponse

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

func (*EchoResponse) Descriptor deprecated

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

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetValue

func (x *EchoResponse) GetValue() 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

type MessageAPIServiceClient

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

MessageAPIServiceClient is the client API for MessageAPIService 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 MessageAPIServiceServer

type MessageAPIServiceServer interface {
	Echo(context.Context, *EchoRequest) (*EchoResponse, error)
	Reverse(context.Context, *ReverseRequest) (*ReverseResponse, error)
}

MessageAPIServiceServer is the server API for MessageAPIService service. All implementations should embed UnimplementedMessageAPIServiceServer for forward compatibility

type ReverseRequest

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

func (*ReverseRequest) Descriptor deprecated

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

Deprecated: Use ReverseRequest.ProtoReflect.Descriptor instead.

func (*ReverseRequest) GetValue

func (x *ReverseRequest) GetValue() string

func (*ReverseRequest) ProtoMessage

func (*ReverseRequest) ProtoMessage()

func (*ReverseRequest) ProtoReflect

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

func (*ReverseRequest) Reset

func (x *ReverseRequest) Reset()

func (*ReverseRequest) String

func (x *ReverseRequest) String() string

type ReverseResponse

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

func (*ReverseResponse) Descriptor deprecated

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

Deprecated: Use ReverseResponse.ProtoReflect.Descriptor instead.

func (*ReverseResponse) GetValue

func (x *ReverseResponse) GetValue() string

func (*ReverseResponse) ProtoMessage

func (*ReverseResponse) ProtoMessage()

func (*ReverseResponse) ProtoReflect

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

func (*ReverseResponse) Reset

func (x *ReverseResponse) Reset()

func (*ReverseResponse) String

func (x *ReverseResponse) String() string

type UnimplementedMessageAPIServiceServer

type UnimplementedMessageAPIServiceServer struct {
}

UnimplementedMessageAPIServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedMessageAPIServiceServer) Echo

func (UnimplementedMessageAPIServiceServer) Reverse

type UnsafeMessageAPIServiceServer

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

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

Jump to

Keyboard shortcuts

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