pb

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var Request_Type_name = map[int32]string{
	0: "UNIVERSAL",
	1: "WEB",
	2: "IMAGES",
	3: "LOCAL",
}
View Source
var Request_Type_value = map[string]int32{
	"UNIVERSAL": 0,
	"WEB":       1,
	"IMAGES":    2,
	"LOCAL":     3,
}
View Source
var Type_name = map[int32]string{
	0: "UNIVERSAL",
	1: "WEB",
	2: "IMAGES",
	3: "LOCAL",
}
View Source
var Type_value = map[string]int32{
	"UNIVERSAL": 0,
	"WEB":       1,
	"IMAGES":    2,
	"LOCAL":     3,
}

Functions

func RegisterSayHandler

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

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

func RegisterSayHandlerClient

func RegisterSayHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SayClient) error

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

func RegisterSayHandlerFromEndpoint

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

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

func RegisterSayServer

func RegisterSayServer(s *grpc.Server, srv SayServer)

func RegisterSayServerHandlerClient

func RegisterSayServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, srv SayServer) error

Types

type Data

type Data struct {
	Data                 []byte   `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Data) Descriptor

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

func (*Data) GetData

func (m *Data) GetData() []byte

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) Reset

func (m *Data) Reset()

func (*Data) String

func (m *Data) String() string

func (*Data) XXX_DiscardUnknown

func (m *Data) XXX_DiscardUnknown()

func (*Data) XXX_Marshal

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

func (*Data) XXX_Merge

func (dst *Data) XXX_Merge(src proto.Message)

func (*Data) XXX_Size

func (m *Data) XXX_Size() int

func (*Data) XXX_Unmarshal

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

type Request

type Request struct {
	Id                   uint32       `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string       `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Age                  int32        `protobuf:"varint,3,opt,name=age,proto3" json:"age,omitempty"`
	Type                 Request_Type `protobuf:"varint,4,opt,name=type,proto3,enum=pb.Request_Type" json:"type,omitempty"`
	Page                 uint32       `protobuf:"varint,5,opt,name=page,proto3" json:"page,omitempty"`
	Limit                int64        `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*Request) Descriptor

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

func (*Request) GetAge

func (m *Request) GetAge() int32

func (*Request) GetId

func (m *Request) GetId() uint32

func (*Request) GetLimit

func (m *Request) GetLimit() int64

func (*Request) GetName

func (m *Request) GetName() string

func (*Request) GetPage

func (m *Request) GetPage() uint32

func (*Request) GetType

func (m *Request) GetType() Request_Type

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 (dst *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 Request_Type

type Request_Type int32
const (
	Request_UNIVERSAL Request_Type = 0
	Request_WEB       Request_Type = 1
	Request_IMAGES    Request_Type = 2
	Request_LOCAL     Request_Type = 3
)

func (Request_Type) EnumDescriptor

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

func (Request_Type) String

func (x Request_Type) String() string

type Response

type Response struct {
	Msg                  string   `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	Type                 Type     `protobuf:"varint,2,opt,name=type,proto3,enum=pb.Type" json:"type,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Response) Descriptor

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

func (*Response) GetMsg

func (m *Response) GetMsg() string

func (*Response) GetType added in v1.1.4

func (m *Response) GetType() Type

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 (dst *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

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

type SayClient

type SayClient interface {
	Hello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Errors(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
	Any(ctx context.Context, in *Data, opts ...grpc.CallOption) (*Data, error)
}

SayClient is the client API for Say service.

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

func NewSayClient

func NewSayClient(cc *grpc.ClientConn) SayClient

func NewSayServerClient

func NewSayServerClient(srv SayServer) SayClient

type SayServer

type SayServer interface {
	Hello(context.Context, *Request) (*Response, error)
	Errors(context.Context, *empty.Empty) (*empty.Empty, error)
	Any(context.Context, *Data) (*Data, error)
}

SayServer is the server API for Say service.

type Type added in v1.1.4

type Type int32
const (
	Type_UNIVERSAL Type = 0
	Type_WEB       Type = 1
	Type_IMAGES    Type = 2
	Type_LOCAL     Type = 3
)

func (Type) EnumDescriptor added in v1.1.4

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

func (Type) String added in v1.1.4

func (x Type) String() string

Jump to

Keyboard shortcuts

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