demo

package
Version: v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package demo is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_idl_demo_demo_proto protoreflect.FileDescriptor

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.Server, srv DemoServiceServer)

Types

type DemoRequest

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

func (*DemoRequest) Descriptor deprecated

This method has been deprecated.
func (*DemoRequest) Descriptor() ([]byte, []int)

Deprecated: Use DemoRequest.ProtoReflect.Descriptor instead.

func (*DemoRequest) GetValue

func (x *DemoRequest) GetValue() string

func (*DemoRequest) ProtoMessage

func (*DemoRequest) ProtoMessage()

func (*DemoRequest) ProtoReflect

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

func (*DemoRequest) Reset

func (x *DemoRequest) Reset()

func (*DemoRequest) String

func (x *DemoRequest) String() string

type DemoResponse

type DemoResponse struct {
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

func (*DemoResponse) Descriptor deprecated

This method has been deprecated.
func (*DemoResponse) Descriptor() ([]byte, []int)

Deprecated: Use DemoResponse.ProtoReflect.Descriptor instead.

func (*DemoResponse) GetCode

func (x *DemoResponse) GetCode() int32

func (*DemoResponse) ProtoMessage

func (*DemoResponse) ProtoMessage()

func (*DemoResponse) ProtoReflect

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

func (*DemoResponse) Reset

func (x *DemoResponse) Reset()

func (*DemoResponse) String

func (x *DemoResponse) String() string

type DemoServiceClient

type DemoServiceClient interface {
	// Echo 样例接口
	Echo(ctx context.Context, in *DemoRequest, opts ...grpc.CallOption) (*DemoResponse, error)
	// Empty 空接口
	Empty(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*EmptyMessage, 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 {
	// Echo 样例接口
	Echo(context.Context, *DemoRequest) (*DemoResponse, error)
	// Empty 空接口
	Empty(context.Context, *EmptyMessage) (*EmptyMessage, error)
	// contains filtered or unexported methods
}

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

type EmptyMessage added in v0.2.0

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

func (*EmptyMessage) Descriptor deprecated added in v0.2.0

This method has been deprecated.
func (*EmptyMessage) Descriptor() ([]byte, []int)

Deprecated: Use EmptyMessage.ProtoReflect.Descriptor instead.

func (*EmptyMessage) ProtoMessage added in v0.2.0

func (*EmptyMessage) ProtoMessage()

func (*EmptyMessage) ProtoReflect added in v0.2.0

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

func (*EmptyMessage) Reset added in v0.2.0

func (x *EmptyMessage) Reset()

func (*EmptyMessage) String added in v0.2.0

func (x *EmptyMessage) String() string

type UnimplementedDemoServiceServer

type UnimplementedDemoServiceServer struct {
}

UnimplementedDemoServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedDemoServiceServer) Echo

func (UnimplementedDemoServiceServer) Empty added in v0.2.0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL