pb

package
v0.0.0-...-d29eeed Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	DemoService_Hi_FullMethodName    = "/demo.pb.DemoService/Hi"
	DemoService_Watch_FullMethodName = "/demo.pb.DemoService/Watch"
)

Variables

View Source
var DemoService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "demo.pb.DemoService",
	HandlerType: (*DemoServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Hi",
			Handler:    _DemoService_Hi_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Watch",
			Handler:       _DemoService_Watch_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "demo.proto",
}

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

Functions

func RegisterDemoServiceHandler

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

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

func RegisterDemoServiceHandlerClient

func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoServiceClient) error

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

func RegisterDemoServiceHandlerFromEndpoint

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

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

func RegisterDemoServiceHandlerServer

func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoServiceServer) error

RegisterDemoServiceHandlerServer registers the http handlers for service DemoService to "mux". UnaryRPC :call DemoServiceServer 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 RegisterDemoServiceHandlerFromEndpoint instead.

func RegisterDemoServiceServer

func RegisterDemoServiceServer(s grpc.ServiceRegistrar, srv DemoServiceServer)

Types

type DemoServiceClient

type DemoServiceClient interface {
	Hi(ctx context.Context, in *HiRequest, opts ...grpc.CallOption) (*HiResponse, error)
	Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (DemoService_WatchClient, error)
}

DemoServiceClient is the client API for DemoService 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 DemoServiceServer

type DemoServiceServer interface {
	Hi(context.Context, *HiRequest) (*HiResponse, error)
	Watch(*WatchRequest, DemoService_WatchServer) error
}

DemoServiceServer is the server API for DemoService service. All implementations should embed UnimplementedDemoServiceServer for forward compatibility

type DemoService_WatchClient

type DemoService_WatchClient interface {
	Recv() (*WatchResponse, error)
	grpc.ClientStream
}

type DemoService_WatchServer

type DemoService_WatchServer interface {
	Send(*WatchResponse) error
	grpc.ServerStream
}

type HiRequest

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

func (*HiRequest) Descriptor deprecated

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

Deprecated: Use HiRequest.ProtoReflect.Descriptor instead.

func (*HiRequest) GetMessage

func (x *HiRequest) GetMessage() string

func (*HiRequest) GetUid

func (x *HiRequest) GetUid() string

func (*HiRequest) ProtoMessage

func (*HiRequest) ProtoMessage()

func (*HiRequest) ProtoReflect

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

func (*HiRequest) Reset

func (x *HiRequest) Reset()

func (*HiRequest) String

func (x *HiRequest) String() string

type HiResponse

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

func (*HiResponse) Descriptor deprecated

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

Deprecated: Use HiResponse.ProtoReflect.Descriptor instead.

func (*HiResponse) GetMessage

func (x *HiResponse) GetMessage() string

func (*HiResponse) ProtoMessage

func (*HiResponse) ProtoMessage()

func (*HiResponse) ProtoReflect

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

func (*HiResponse) Reset

func (x *HiResponse) Reset()

func (*HiResponse) String

func (x *HiResponse) String() string

type UnimplementedDemoServiceServer

type UnimplementedDemoServiceServer struct {
}

UnimplementedDemoServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedDemoServiceServer) Hi

func (UnimplementedDemoServiceServer) Watch

type UnsafeDemoServiceServer

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

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

type WatchRequest

type WatchRequest struct {
	Uid   string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"`
	// contains filtered or unexported fields
}

func (*WatchRequest) Descriptor deprecated

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

Deprecated: Use WatchRequest.ProtoReflect.Descriptor instead.

func (*WatchRequest) GetTopic

func (x *WatchRequest) GetTopic() string

func (*WatchRequest) GetUid

func (x *WatchRequest) GetUid() string

func (*WatchRequest) ProtoMessage

func (*WatchRequest) ProtoMessage()

func (*WatchRequest) ProtoReflect

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

func (*WatchRequest) Reset

func (x *WatchRequest) Reset()

func (*WatchRequest) String

func (x *WatchRequest) String() string

type WatchResponse

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

func (*WatchResponse) Descriptor deprecated

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

Deprecated: Use WatchResponse.ProtoReflect.Descriptor instead.

func (*WatchResponse) GetMessage

func (x *WatchResponse) GetMessage() string

func (*WatchResponse) ProtoMessage

func (*WatchResponse) ProtoMessage()

func (*WatchResponse) ProtoReflect

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

func (*WatchResponse) Reset

func (x *WatchResponse) Reset()

func (*WatchResponse) String

func (x *WatchResponse) String() string

Jump to

Keyboard shortcuts

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