protogen

package
Version: v0.0.0-...-6ad1837 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package protogen is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTestServiceHandler

func RegisterTestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) 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.

func RegisterTestServiceServer

func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer)

Types

type HelloMessage

type HelloMessage struct {
	HelloString          string   `protobuf:"bytes,1,opt,name=hello_string,json=helloString,proto3" json:"hello_string,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

HelloMessage is a protobuf message for automatic tests.

func (*HelloMessage) Descriptor

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

func (*HelloMessage) GetHelloString

func (m *HelloMessage) GetHelloString() string

func (*HelloMessage) ProtoMessage

func (*HelloMessage) ProtoMessage()

func (*HelloMessage) Reset

func (m *HelloMessage) Reset()

func (*HelloMessage) String

func (m *HelloMessage) String() string

func (*HelloMessage) XXX_DiscardUnknown

func (m *HelloMessage) XXX_DiscardUnknown()

func (*HelloMessage) XXX_Marshal

func (m *HelloMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HelloMessage) XXX_Merge

func (m *HelloMessage) XXX_Merge(src proto.Message)

func (*HelloMessage) XXX_Size

func (m *HelloMessage) XXX_Size() int

func (*HelloMessage) XXX_Unmarshal

func (m *HelloMessage) XXX_Unmarshal(b []byte) error

type TestServiceClient

type TestServiceClient interface {
	// SayHello receives a HelloMessage and replies another HelloMessage with its string doubled.
	SayHello(ctx context.Context, in *HelloMessage, opts ...grpc.CallOption) (*HelloMessage, error)
}

TestServiceClient is the client API for TestService service.

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

func NewTestServiceClient

func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient

type TestServiceServer

type TestServiceServer interface {
	// SayHello receives a HelloMessage and replies another HelloMessage with its string doubled.
	SayHello(context.Context, *HelloMessage) (*HelloMessage, error)
}

TestServiceServer is the server API for TestService service.

type UnimplementedTestServiceServer

type UnimplementedTestServiceServer struct {
}

UnimplementedTestServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedTestServiceServer) SayHello

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