example

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 20 Imported by: 0

README

APIs

Document generated by protoc-gen-markdown. DO NOT EDIT!

Example - Example Service.

Example Service.

markdown h1

markdown test

ExampleB - Example2 Service.

Example2 Service.

Documentation

Overview

Package example is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const Default_Request_Name string = "abc"

Variables

View Source
var RequestType_name = map[int32]string{
	0: "_NONE",
	1: "TYPE1",
	2: "TYPE2",
}
View Source
var RequestType_value = map[string]int32{
	"_NONE": 0,
	"TYPE1": 1,
	"TYPE2": 2,
}

Functions

func RegisterExampleBHandler

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

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

func RegisterExampleBHandlerClient

func RegisterExampleBHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleBClient) error

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

func RegisterExampleBHandlerFromEndpoint

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

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

func RegisterExampleBHandlerServer

func RegisterExampleBHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleBServer) error

RegisterExampleBHandlerServer registers the http handlers for service ExampleB to "mux". UnaryRPC :call ExampleBServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterExampleBScopeServer

func RegisterExampleBScopeServer(component string, auth service.Authenticator, impl service.Implementor, srv ExampleBServer) error

Register scoped server.

func RegisterExampleBServer

func RegisterExampleBServer(s *grpc.Server, srv ExampleBServer)

func RegisterExampleBWsHandlerServer added in v0.5.0

func RegisterExampleBWsHandlerServer(mux *runtime.ServeMux, srv ExampleBServer, streamInterceptor grpc.StreamServerInterceptor) error

func RegisterExampleScopeServer

func RegisterExampleScopeServer(component string, auth service.Authenticator, impl service.Implementor, srv ExampleServer) error

Register scoped server.

func RegisterExampleServer

func RegisterExampleServer(s *grpc.Server, srv ExampleServer)

Types

type ExampleBClient

type ExampleBClient interface {
	// test2 comment
	Test2(ctx context.Context, in *Request, opts ...grpc.CallOption) (*empty.Empty, error)
	// test3 interface
	TestA(ctx context.Context, opts ...grpc.CallOption) (ExampleB_TestAClient, error)
}

ExampleBClient is the client API for ExampleB service.

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

func NewExampleBClient

func NewExampleBClient(cc *grpc.ClientConn) ExampleBClient

type ExampleBServer

type ExampleBServer interface {
	// test2 comment
	Test2(context.Context, *Request) (*empty.Empty, error)
	// test3 interface
	TestA(ExampleB_TestAServer) error
}

ExampleBServer is the server API for ExampleB service.

type ExampleB_TestAClient added in v0.5.0

type ExampleB_TestAClient interface {
	Send(*Request) error
	CloseAndRecv() (*Response, error)
	grpc.ClientStream
}

type ExampleB_TestAServer added in v0.5.0

type ExampleB_TestAServer interface {
	SendAndClose(*Response) error
	Recv() (*Request, error)
	grpc.ServerStream
}

type ExampleClient

type ExampleClient interface {
	// test1 comment
	Test1(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

ExampleClient is the client API for Example service.

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

func NewExampleClient

func NewExampleClient(cc *grpc.ClientConn) ExampleClient

type ExampleServer

type ExampleServer interface {
	// test1 comment
	Test1(context.Context, *Request) (*Response, error)
}

ExampleServer is the server API for Example service.

type Request

type Request struct {
	//
	// leading comment
	// 2rd comment line
	//
	Id                   *int32                 `protobuf:"varint,1,req,name=id" json:"id,omitempty"`
	Name                 *string                `protobuf:"bytes,2,opt,name=name,def=abc" json:"name,omitempty"`
	Type                 *RequestType           `protobuf:"varint,3,opt,name=type,enum=example.RequestType" json:"type,omitempty"`
	Array                []string               `protobuf:"bytes,4,rep,name=array" json:"array,omitempty"`
	Map                  map[string]RequestType `` /* 152-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

Message Request type

func (*Request) Descriptor

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

func (*Request) GetArray

func (m *Request) GetArray() []string

func (*Request) GetId

func (m *Request) GetId() int32

func (*Request) GetMap

func (m *Request) GetMap() map[string]RequestType

func (*Request) GetName

func (m *Request) GetName() string

func (*Request) GetType

func (m *Request) GetType() RequestType

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

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

func (*Request) XXX_Merge

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

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

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

type RequestType

type RequestType int32
const (
	RequestType__NONE RequestType = 0
	RequestType_TYPE1 RequestType = 1
	// request type 2
	RequestType_TYPE2 RequestType = 2
)

func (RequestType) Enum

func (x RequestType) Enum() *RequestType

func (RequestType) EnumDescriptor

func (RequestType) EnumDescriptor() ([]byte, []int)

func (RequestType) String

func (x RequestType) String() string

func (*RequestType) UnmarshalJSON

func (x *RequestType) UnmarshalJSON(data []byte) error

type Response

type Response struct {
	Embed *Response_Embed `protobuf:"bytes,1,opt,name=embed" json:"embed,omitempty"`
	// Types that are valid to be assigned to TestOneof:
	//	*Response_Name0
	//	*Response_Name1
	//	*Response_Name2
	TestOneof            isResponse_TestOneof `protobuf_oneof:"test_oneof"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

func (*Response) Descriptor

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

func (*Response) GetEmbed

func (m *Response) GetEmbed() *Response_Embed

func (*Response) GetName0

func (m *Response) GetName0() string

func (*Response) GetName1

func (m *Response) GetName1() string

func (*Response) GetName2

func (m *Response) GetName2() string

func (*Response) GetTestOneof

func (m *Response) GetTestOneof() isResponse_TestOneof

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

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

func (*Response) XXX_Merge

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

func (*Response) XXX_OneofWrappers

func (*Response) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

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

type Response_Embed

type Response_Embed struct {
	Id                   *int32   `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Response_Embed) Descriptor

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

func (*Response_Embed) GetId

func (m *Response_Embed) GetId() int32

func (*Response_Embed) ProtoMessage

func (*Response_Embed) ProtoMessage()

func (*Response_Embed) Reset

func (m *Response_Embed) Reset()

func (*Response_Embed) String

func (m *Response_Embed) String() string

func (*Response_Embed) XXX_DiscardUnknown

func (m *Response_Embed) XXX_DiscardUnknown()

func (*Response_Embed) XXX_Marshal

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

func (*Response_Embed) XXX_Merge

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

func (*Response_Embed) XXX_Size

func (m *Response_Embed) XXX_Size() int

func (*Response_Embed) XXX_Unmarshal

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

type Response_Name0

type Response_Name0 struct {
	Name0 string `protobuf:"bytes,2,opt,name=name0,oneof"`
}

type Response_Name1

type Response_Name1 struct {
	Name1 string `protobuf:"bytes,3,opt,name=name1,oneof"`
}

type Response_Name2

type Response_Name2 struct {
	Name2 string `protobuf:"bytes,4,opt,name=name2,oneof"`
}

type UnimplementedExampleBServer

type UnimplementedExampleBServer struct {
}

UnimplementedExampleBServer can be embedded to have forward compatible implementations.

func (*UnimplementedExampleBServer) Test2

func (*UnimplementedExampleBServer) TestA

type UnimplementedExampleServer

type UnimplementedExampleServer struct {
}

UnimplementedExampleServer can be embedded to have forward compatible implementations.

func (*UnimplementedExampleServer) Test1

Jump to

Keyboard shortcuts

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