pb

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: Apache-2.0 Imports: 30 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 (
	Type_name = map[int32]string{
		0: "UNIVERSAL",
		1: "WEB",
		2: "IMAGES",
		3: "LOCAL",
	}
	Type_value = map[string]int32{
		"UNIVERSAL": 0,
		"WEB":       1,
		"IMAGES":    2,
		"LOCAL":     3,
	}
)

Enum value maps for Type.

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 RegisterSayHandlerServer

func RegisterSayHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SayServer) error

RegisterSayHandlerServer registers the http handlers for service Say to "mux". UnaryRPC :call SayServer 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 RegisterSayHandlerFromEndpoint instead.

func RegisterSayServer

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

Types

type Data

type Data struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*Data) Descriptor deprecated

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

Deprecated: Use Data.ProtoReflect.Descriptor instead.

func (*Data) GetData

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

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) ProtoReflect

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

func (*Data) Reset

func (x *Data) Reset()

func (*Data) String

func (x *Data) String() string

func (*Data) Validate

func (m *Data) Validate() error

Validate checks the field values on Data with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type DataValidationError added in v1.5.2

type DataValidationError struct {
	// contains filtered or unexported fields
}

DataValidationError is the validation error returned by Data.Validate if the designated constraints aren't met.

func (DataValidationError) Cause added in v1.5.2

func (e DataValidationError) Cause() error

Cause function returns cause value.

func (DataValidationError) Error added in v1.5.2

func (e DataValidationError) Error() string

Error satisfies the builtin error interface

func (DataValidationError) ErrorName added in v1.5.2

func (e DataValidationError) ErrorName() string

ErrorName returns error name.

func (DataValidationError) Field added in v1.5.2

func (e DataValidationError) Field() string

Field function returns field value.

func (DataValidationError) Key added in v1.5.2

func (e DataValidationError) Key() bool

Key function returns key value.

func (DataValidationError) Reason added in v1.5.2

func (e DataValidationError) Reason() string

Reason function returns reason value.

type Request

type Request struct {
	Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetId

func (x *Request) GetId() uint32

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

func (*Request) Validate

func (m *Request) Validate() error

Validate checks the field values on Request with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type RequestValidationError added in v1.5.2

type RequestValidationError struct {
	// contains filtered or unexported fields
}

RequestValidationError is the validation error returned by Request.Validate if the designated constraints aren't met.

func (RequestValidationError) Cause added in v1.5.2

func (e RequestValidationError) Cause() error

Cause function returns cause value.

func (RequestValidationError) Error added in v1.5.2

func (e RequestValidationError) Error() string

Error satisfies the builtin error interface

func (RequestValidationError) ErrorName added in v1.5.2

func (e RequestValidationError) ErrorName() string

ErrorName returns error name.

func (RequestValidationError) Field added in v1.5.2

func (e RequestValidationError) Field() string

Field function returns field value.

func (RequestValidationError) Key added in v1.5.2

func (e RequestValidationError) Key() bool

Key function returns key value.

func (RequestValidationError) Reason added in v1.5.2

func (e RequestValidationError) Reason() string

Reason function returns reason value.

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"`
	IsSuccess bool   `protobuf:"varint,3,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetIsSuccess

func (x *Response) GetIsSuccess() bool

func (*Response) GetMsg

func (x *Response) GetMsg() string

func (*Response) GetType

func (x *Response) GetType() Type

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

func (*Response) Validate

func (m *Response) Validate() error

Validate checks the field values on Response with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type ResponseValidationError added in v1.5.2

type ResponseValidationError struct {
	// contains filtered or unexported fields
}

ResponseValidationError is the validation error returned by Response.Validate if the designated constraints aren't met.

func (ResponseValidationError) Cause added in v1.5.2

func (e ResponseValidationError) Cause() error

Cause function returns cause value.

func (ResponseValidationError) Error added in v1.5.2

func (e ResponseValidationError) Error() string

Error satisfies the builtin error interface

func (ResponseValidationError) ErrorName added in v1.5.2

func (e ResponseValidationError) ErrorName() string

ErrorName returns error name.

func (ResponseValidationError) Field added in v1.5.2

func (e ResponseValidationError) Field() string

Field function returns field value.

func (ResponseValidationError) Key added in v1.5.2

func (e ResponseValidationError) Key() bool

Key function returns key value.

func (ResponseValidationError) Reason added in v1.5.2

func (e ResponseValidationError) Reason() string

Reason function returns reason value.

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://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewSayClient

func NewSayClient(cc grpc.ClientConnInterface) 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)
	// contains filtered or unexported methods
}

SayServer is the server API for Say service. All implementations must embed UnimplementedSayServer for forward compatibility

type Type

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

func (Type) Descriptor

func (Type) Descriptor() protoreflect.EnumDescriptor

func (Type) Enum

func (x Type) Enum() *Type

func (Type) EnumDescriptor deprecated

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

Deprecated: Use Type.Descriptor instead.

func (Type) Number

func (x Type) Number() protoreflect.EnumNumber

func (Type) String

func (x Type) String() string

func (Type) Type

func (Type) Type() protoreflect.EnumType

type UnimplementedSayServer

type UnimplementedSayServer struct {
}

UnimplementedSayServer must be embedded to have forward compatible implementations.

func (UnimplementedSayServer) Any

func (UnimplementedSayServer) Errors

func (UnimplementedSayServer) Hello

type UnsafeSayServer added in v1.5.2

type UnsafeSayServer interface {
	// contains filtered or unexported methods
}

UnsafeSayServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SayServer will result in compilation errors.

Jump to

Keyboard shortcuts

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