pb

package
v0.0.0-...-976936d Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_service_proto protoreflect.FileDescriptor
View Source
var TestService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "your.service.v1.TestService",
	HandlerType: (*TestServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Hello",
			Handler:    _TestService_Hello_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service.proto",
}

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

Functions

func RegisterTestServiceHandler

func RegisterTestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn grpc.ClientConnInterface) error

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

func RegisterTestServiceHandlerClient

func RegisterTestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestServiceClient) error

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

func RegisterTestServiceHandlerFromEndpoint

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

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

func RegisterTestServiceHandlerServer

func RegisterTestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestServiceServer) error

RegisterTestServiceHandlerServer registers the http handlers for service TestService to "mux". UnaryRPC :call TestServiceServer 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 RegisterTestServiceHandlerFromEndpoint instead.

func RegisterTestServiceServer

func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)

Types

type HelloReq

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

func (*HelloReq) Descriptor deprecated

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

Deprecated: Use HelloReq.ProtoReflect.Descriptor instead.

func (*HelloReq) GetName

func (x *HelloReq) GetName() string

func (*HelloReq) ProtoMessage

func (*HelloReq) ProtoMessage()

func (*HelloReq) ProtoReflect

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

func (*HelloReq) Reset

func (x *HelloReq) Reset()

func (*HelloReq) String

func (x *HelloReq) String() string

type HelloRes

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

func (*HelloRes) Descriptor deprecated

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

Deprecated: Use HelloRes.ProtoReflect.Descriptor instead.

func (*HelloRes) GetMsg

func (x *HelloRes) GetMsg() string

func (*HelloRes) ProtoMessage

func (*HelloRes) ProtoMessage()

func (*HelloRes) ProtoReflect

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

func (*HelloRes) Reset

func (x *HelloRes) Reset()

func (*HelloRes) String

func (x *HelloRes) String() string

type TestServiceClient

type TestServiceClient interface {
	Hello(ctx context.Context, in *HelloReq, opts ...grpc.CallOption) (*HelloRes, error)
}

TestServiceClient is the client API for TestService 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 TestServiceServer

type TestServiceServer interface {
	Hello(context.Context, *HelloReq) (*HelloRes, error)
}

TestServiceServer is the server API for TestService service. All implementations should embed UnimplementedTestServiceServer for forward compatibility

type UnimplementedTestServiceServer

type UnimplementedTestServiceServer struct {
}

UnimplementedTestServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedTestServiceServer) Hello

type UnsafeTestServiceServer

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

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

Jump to

Keyboard shortcuts

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