hello

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package hello is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_example_proto_hello_api1_proto protoreflect.FileDescriptor
View Source
var File_example_proto_hello_api_proto protoreflect.FileDescriptor
View Source
var File_example_proto_hello_transport_proto protoreflect.FileDescriptor

Functions

func GetTestApiClient

func GetTestApiClient(srv string, opts ...grpc.DialOption) func() (TestApiClient, error)

func GetTestApiV2Client

func GetTestApiV2Client(srv string, opts ...grpc.DialOption) func() (TestApiV2Client, error)

func GetTransportClient

func GetTransportClient(srv string, opts ...grpc.DialOption) func() (TransportClient, error)

func RegisterTestApiHandler added in v0.0.11

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

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

func RegisterTestApiHandlerClient added in v0.0.11

func RegisterTestApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestApiClient) error

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

func RegisterTestApiHandlerFromEndpoint added in v0.0.11

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

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

func RegisterTestApiHandlerServer added in v0.0.11

func RegisterTestApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestApiServer) error

RegisterTestApiHandlerServer registers the http handlers for service TestApi to "mux". UnaryRPC :call TestApiServer 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 RegisterTestApiHandlerFromEndpoint instead.

func RegisterTestApiServer

func RegisterTestApiServer(s *grpc.Server, srv TestApiServer)

func RegisterTestApiV2Handler added in v0.0.11

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

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

func RegisterTestApiV2HandlerClient added in v0.0.11

func RegisterTestApiV2HandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestApiV2Client) error

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

func RegisterTestApiV2HandlerFromEndpoint added in v0.0.11

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

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

func RegisterTestApiV2HandlerServer added in v0.0.11

func RegisterTestApiV2HandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestApiV2Server) error

RegisterTestApiV2HandlerServer registers the http handlers for service TestApiV2 to "mux". UnaryRPC :call TestApiV2Server 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 RegisterTestApiV2HandlerFromEndpoint instead.

func RegisterTestApiV2Server

func RegisterTestApiV2Server(s *grpc.Server, srv TestApiV2Server)

func RegisterTransportServer

func RegisterTransportServer(s *grpc.Server, srv TransportServer)

Types

type Message

type Message struct {
	Header map[string]string `` /* 153-byte string literal not displayed */
	Body   []byte            `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetBody

func (x *Message) GetBody() []byte

func (*Message) GetHeader

func (x *Message) GetHeader() map[string]string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type TestApiClient

type TestApiClient interface {
	Version(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error)
	VersionTest(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error)
}

TestApiClient is the client API for TestApi service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTestApiClient

func NewTestApiClient(cc grpc.ClientConnInterface) TestApiClient

type TestApiData

type TestApiData struct {
	Version    string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	SrvVersion string `protobuf:"bytes,2,opt,name=srvVersion,proto3" json:"srvVersion,omitempty"`
	// contains filtered or unexported fields
}

func (*TestApiData) Descriptor deprecated

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

Deprecated: Use TestApiData.ProtoReflect.Descriptor instead.

func (*TestApiData) GetSrvVersion

func (x *TestApiData) GetSrvVersion() string

func (*TestApiData) GetVersion

func (x *TestApiData) GetVersion() string

func (*TestApiData) ProtoMessage

func (*TestApiData) ProtoMessage()

func (*TestApiData) ProtoReflect

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

func (*TestApiData) Reset

func (x *TestApiData) Reset()

func (*TestApiData) String

func (x *TestApiData) String() string

type TestApiOutput

type TestApiOutput struct {
	Code    int32        `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Msg     string       `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	NowTime int64        `protobuf:"varint,3,opt,name=nowTime,proto3" json:"nowTime,omitempty"`
	Data    *TestApiData `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*TestApiOutput) Descriptor deprecated

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

Deprecated: Use TestApiOutput.ProtoReflect.Descriptor instead.

func (*TestApiOutput) GetCode

func (x *TestApiOutput) GetCode() int32

func (*TestApiOutput) GetData

func (x *TestApiOutput) GetData() *TestApiData

func (*TestApiOutput) GetMsg

func (x *TestApiOutput) GetMsg() string

func (*TestApiOutput) GetNowTime

func (x *TestApiOutput) GetNowTime() int64

func (*TestApiOutput) ProtoMessage

func (*TestApiOutput) ProtoMessage()

func (*TestApiOutput) ProtoReflect

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

func (*TestApiOutput) Reset

func (x *TestApiOutput) Reset()

func (*TestApiOutput) String

func (x *TestApiOutput) String() string

type TestApiServer

type TestApiServer interface {
	Version(context.Context, *TestReq) (*TestApiOutput, error)
	VersionTest(context.Context, *TestReq) (*TestApiOutput, error)
}

TestApiServer is the server API for TestApi service.

type TestApiV2Client

type TestApiV2Client interface {
	Version1(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error)
	VersionTest1(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error)
}

TestApiV2Client is the client API for TestApiV2 service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTestApiV2Client

func NewTestApiV2Client(cc grpc.ClientConnInterface) TestApiV2Client

type TestApiV2Server

type TestApiV2Server interface {
	Version1(context.Context, *TestReq) (*TestApiOutput, error)
	VersionTest1(context.Context, *TestReq) (*TestApiOutput, error)
}

TestApiV2Server is the server API for TestApiV2 service.

type TestReq

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

func (*TestReq) Descriptor deprecated

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

Deprecated: Use TestReq.ProtoReflect.Descriptor instead.

func (*TestReq) GetInput

func (x *TestReq) GetInput() string

func (*TestReq) ProtoMessage

func (*TestReq) ProtoMessage()

func (*TestReq) ProtoReflect

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

func (*TestReq) Reset

func (x *TestReq) Reset()

func (*TestReq) String

func (x *TestReq) String() string

type TransportClient

type TransportClient interface {
	TestStream(ctx context.Context, opts ...grpc.CallOption) (Transport_TestStreamClient, error)
	TestStream1(ctx context.Context, opts ...grpc.CallOption) (Transport_TestStream1Client, error)
	TestStream2(ctx context.Context, in *Message, opts ...grpc.CallOption) (Transport_TestStream2Client, error)
	TestStream3(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error)
}

TransportClient is the client API for Transport service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTransportClient

func NewTransportClient(cc grpc.ClientConnInterface) TransportClient

type TransportServer

type TransportServer interface {
	TestStream(Transport_TestStreamServer) error
	TestStream1(Transport_TestStream1Server) error
	TestStream2(*Message, Transport_TestStream2Server) error
	TestStream3(context.Context, *Message) (*Message, error)
}

TransportServer is the server API for Transport service.

type Transport_TestStream1Client

type Transport_TestStream1Client interface {
	Send(*Message) error
	CloseAndRecv() (*Message, error)
	grpc.ClientStream
}

type Transport_TestStream1Server

type Transport_TestStream1Server interface {
	SendAndClose(*Message) error
	Recv() (*Message, error)
	grpc.ServerStream
}

type Transport_TestStream2Client

type Transport_TestStream2Client interface {
	Recv() (*Message, error)
	grpc.ClientStream
}

type Transport_TestStream2Server

type Transport_TestStream2Server interface {
	Send(*Message) error
	grpc.ServerStream
}

type Transport_TestStreamClient

type Transport_TestStreamClient interface {
	Send(*Message) error
	Recv() (*Message, error)
	grpc.ClientStream
}

type Transport_TestStreamServer

type Transport_TestStreamServer interface {
	Send(*Message) error
	Recv() (*Message, error)
	grpc.ServerStream
}

type UnimplementedTestApiServer

type UnimplementedTestApiServer struct {
}

UnimplementedTestApiServer can be embedded to have forward compatible implementations.

func (*UnimplementedTestApiServer) Version

func (*UnimplementedTestApiServer) VersionTest

type UnimplementedTestApiV2Server

type UnimplementedTestApiV2Server struct {
}

UnimplementedTestApiV2Server can be embedded to have forward compatible implementations.

func (*UnimplementedTestApiV2Server) Version1

func (*UnimplementedTestApiV2Server) VersionTest1

type UnimplementedTransportServer

type UnimplementedTransportServer struct {
}

UnimplementedTransportServer can be embedded to have forward compatible implementations.

func (*UnimplementedTransportServer) TestStream

func (*UnimplementedTransportServer) TestStream1

func (*UnimplementedTransportServer) TestStream2

func (*UnimplementedTransportServer) TestStream3

Jump to

Keyboard shortcuts

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