Documentation
¶
Overview ¶
Package demo is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterDemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoServiceClient) error
- func RegisterDemoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoServiceServer) error
- func RegisterDemoServiceServer(s grpc.ServiceRegistrar, srv DemoServiceServer)
- type DemoServiceClient
- type DemoServiceServer
- type OurTeam
- type StringMessage
- type UnimplementedDemoServiceServer
- type UnsafeDemoServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( OurTeam_name = map[int32]string{ 0: "devad", } OurTeam_value = map[string]int32{ "devad": 0, } )
Enum value maps for OurTeam.
var DemoService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "demo.DemoService", HandlerType: (*DemoServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _DemoService_Echo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "idl/demo/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)
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.ServiceRegistrar, srv DemoServiceServer)
Types ¶
type DemoServiceClient ¶
type DemoServiceClient interface { // Echo 样例接口 Echo(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, 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.
func NewDemoServiceClient ¶
func NewDemoServiceClient(cc grpc.ClientConnInterface) DemoServiceClient
type DemoServiceServer ¶
type DemoServiceServer interface { // Echo 样例接口 Echo(context.Context, *StringMessage) (*StringMessage, error) // contains filtered or unexported methods }
DemoServiceServer is the server API for DemoService service. All implementations must embed UnimplementedDemoServiceServer for forward compatibility
type OurTeam ¶
type OurTeam int32
const ( // github: devad OurTeam_devad OurTeam = 0 )
func (OurTeam) Descriptor ¶
func (OurTeam) Descriptor() protoreflect.EnumDescriptor
func (OurTeam) Number ¶
func (x OurTeam) Number() protoreflect.EnumNumber
func (OurTeam) Type ¶
func (OurTeam) Type() protoreflect.EnumType
type StringMessage ¶
type StringMessage struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*StringMessage) Descriptor
deprecated
func (*StringMessage) Descriptor() ([]byte, []int)
Deprecated: Use StringMessage.ProtoReflect.Descriptor instead.
func (*StringMessage) GetValue ¶
func (x *StringMessage) GetValue() string
func (*StringMessage) ProtoMessage ¶
func (*StringMessage) ProtoMessage()
func (*StringMessage) ProtoReflect ¶
func (x *StringMessage) ProtoReflect() protoreflect.Message
func (*StringMessage) Reset ¶
func (x *StringMessage) Reset()
func (*StringMessage) String ¶
func (x *StringMessage) String() string
type UnimplementedDemoServiceServer ¶
type UnimplementedDemoServiceServer struct { }
UnimplementedDemoServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedDemoServiceServer) Echo ¶
func (UnimplementedDemoServiceServer) Echo(context.Context, *StringMessage) (*StringMessage, error)
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.
Source Files
¶
- demo.pb.go
- demo.pb.gw.go
- demo_grpc.pb.go