Documentation
¶
Overview ¶
Package proto is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterDemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoServiceClient) error
- func RegisterDemoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoServiceServer) error
- func RegisterDemoServiceServer(s *grpc.Server, srv DemoServiceServer)
- type Custom
- type Demo
- func (*Demo) Descriptor() ([]byte, []int)deprecated
- func (x *Demo) GetClearinheritance() []string
- func (x *Demo) GetIgnored() int32
- func (x *Demo) GetInternal() *Demo_Internal
- func (x *Demo) GetInternalRepeated() []*Demo_Internal
- func (x *Demo) GetMyMap() map[string]string
- func (x *Demo) GetNonepreprocessRepeated() []string
- func (x *Demo) GetPreprocessRepeatedField2() []string
- func (x *Demo) GetPreprocessedField() string
- func (x *Demo) GetPreprocessedRepeatedField() []string
- func (x *Demo) GetSub() *SubObject
- func (x *Demo) GetSubRepeated() []*SubObject
- func (x *Demo) GetTime() *timestamppb.Timestamp
- func (m *Demo) Preprocess() error
- func (*Demo) ProtoMessage()
- func (x *Demo) ProtoReflect() protoreflect.Message
- func (x *Demo) Reset()
- func (x *Demo) String() string
- type DemoServiceClient
- type DemoServiceServer
- type Demo_Internal
- func (*Demo_Internal) Descriptor() ([]byte, []int)deprecated
- func (x *Demo_Internal) GetInternalString() string
- func (m *Demo_Internal) Preprocess() error
- func (*Demo_Internal) ProtoMessage()
- func (x *Demo_Internal) ProtoReflect() protoreflect.Message
- func (x *Demo_Internal) Reset()
- func (x *Demo_Internal) String() string
- type SubObject
- type UnimplementedDemoServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_example_proto_demo_proto protoreflect.FileDescriptor
Functions ¶
func RegisterDemoServiceHandler ¶
func RegisterDemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterDemoServiceHandler registers the http handlers for service DemoService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterDemoServiceHandlerClient ¶
func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoServiceClient) error
RegisterDemoServiceHandlerClient registers the http handlers for service DemoService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DemoServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DemoServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DemoServiceClient" to call the correct interceptors.
func RegisterDemoServiceHandlerFromEndpoint ¶
func RegisterDemoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterDemoServiceHandlerFromEndpoint is same as RegisterDemoServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDemoServiceHandlerServer ¶ added in v0.4.2
func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoServiceServer) error
RegisterDemoServiceHandlerServer registers the http handlers for service DemoService to "mux". UnaryRPC :call DemoServiceServer 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 RegisterDemoServiceHandlerFromEndpoint instead.
func RegisterDemoServiceServer ¶
func RegisterDemoServiceServer(s *grpc.Server, srv DemoServiceServer)
Types ¶
type Custom ¶
type Custom struct { DoItYourself string `protobuf:"bytes,1,opt,name=doItYourself,proto3" json:"doItYourself,omitempty"` // contains filtered or unexported fields }
This message left as is to show that we can provide our own preprocessors
func (*Custom) Descriptor
deprecated
func (*Custom) GetDoItYourself ¶
func (*Custom) Preprocess ¶
func (*Custom) ProtoMessage ¶
func (*Custom) ProtoMessage()
func (*Custom) ProtoReflect ¶ added in v0.4.2
func (x *Custom) ProtoReflect() protoreflect.Message
type Demo ¶
type Demo struct { // Also it is possible to specify additional method on field level PreprocessedField string `protobuf:"bytes,1,opt,name=preprocessedField,proto3" json:"preprocessedField,omitempty"` // Preprocessor automatically checks if field is repeated and generates methods accordingly PreprocessedRepeatedField []string `protobuf:"bytes,2,rep,name=preprocessedRepeatedField,proto3" json:"preprocessedRepeatedField,omitempty"` // If a field does not fit preprocess method, it is just ignored Ignored int32 `protobuf:"varint,3,opt,name=ignored,proto3" json:"ignored,omitempty"` Sub *SubObject `protobuf:"bytes,4,opt,name=sub,proto3" json:"sub,omitempty"` SubRepeated []*SubObject `protobuf:"bytes,5,rep,name=sub_repeated,json=subRepeated,proto3" json:"sub_repeated,omitempty"` Internal *Demo_Internal `protobuf:"bytes,6,opt,name=internal,proto3" json:"internal,omitempty"` InternalRepeated []*Demo_Internal `protobuf:"bytes,7,rep,name=internal_repeated,json=internalRepeated,proto3" json:"internal_repeated,omitempty"` MyMap map[string]string `` /* 151-byte string literal not displayed */ PreprocessRepeatedField2 []string `protobuf:"bytes,9,rep,name=preprocessRepeatedField2,proto3" json:"preprocessRepeatedField2,omitempty"` // must generate trim because none is an alias for no-op, no idea for what reason it was implemented // but must keep it for backward compatibility. NonepreprocessRepeated []string `protobuf:"bytes,10,rep,name=nonepreprocessRepeated,proto3" json:"nonepreprocessRepeated,omitempty"` // clear must clear previous settings in inheritance chain and put only lower preprocessing. Clearinheritance []string `protobuf:"bytes,11,rep,name=clearinheritance,proto3" json:"clearinheritance,omitempty"` // should not be preprocessed Time *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=time,proto3" json:"time,omitempty"` // contains filtered or unexported fields }
func (*Demo) Descriptor
deprecated
func (*Demo) GetClearinheritance ¶ added in v0.3.3
func (*Demo) GetIgnored ¶
func (*Demo) GetInternal ¶ added in v0.3.0
func (x *Demo) GetInternal() *Demo_Internal
func (*Demo) GetInternalRepeated ¶ added in v0.3.0
func (x *Demo) GetInternalRepeated() []*Demo_Internal
func (*Demo) GetNonepreprocessRepeated ¶ added in v0.3.3
func (*Demo) GetPreprocessRepeatedField2 ¶ added in v0.3.3
func (*Demo) GetPreprocessedField ¶
func (*Demo) GetPreprocessedRepeatedField ¶
func (*Demo) GetSubRepeated ¶ added in v0.3.0
func (*Demo) GetTime ¶ added in v0.4.2
func (x *Demo) GetTime() *timestamppb.Timestamp
func (*Demo) Preprocess ¶
func (*Demo) ProtoMessage ¶
func (*Demo) ProtoMessage()
func (*Demo) ProtoReflect ¶ added in v0.4.2
func (x *Demo) ProtoReflect() protoreflect.Message
type DemoServiceClient ¶
type DemoServiceClient interface {
Echo(ctx context.Context, in *Demo, opts ...grpc.CallOption) (*Demo, error)
}
DemoServiceClient is the client API for DemoService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewDemoServiceClient ¶
func NewDemoServiceClient(cc grpc.ClientConnInterface) DemoServiceClient
type DemoServiceServer ¶
DemoServiceServer is the server API for DemoService service.
type Demo_Internal ¶ added in v0.3.0
type Demo_Internal struct { InternalString string `protobuf:"bytes,1,opt,name=internal_string,json=internalString,proto3" json:"internal_string,omitempty"` // contains filtered or unexported fields }
func (*Demo_Internal) Descriptor
deprecated
added in
v0.3.0
func (*Demo_Internal) Descriptor() ([]byte, []int)
Deprecated: Use Demo_Internal.ProtoReflect.Descriptor instead.
func (*Demo_Internal) GetInternalString ¶ added in v0.3.0
func (x *Demo_Internal) GetInternalString() string
func (*Demo_Internal) Preprocess ¶ added in v0.3.0
func (m *Demo_Internal) Preprocess() error
func (*Demo_Internal) ProtoMessage ¶ added in v0.3.0
func (*Demo_Internal) ProtoMessage()
func (*Demo_Internal) ProtoReflect ¶ added in v0.4.2
func (x *Demo_Internal) ProtoReflect() protoreflect.Message
func (*Demo_Internal) Reset ¶ added in v0.3.0
func (x *Demo_Internal) Reset()
func (*Demo_Internal) String ¶ added in v0.3.0
func (x *Demo_Internal) String() string
type SubObject ¶ added in v0.3.0
type SubObject struct { StrVal string `protobuf:"bytes,1,opt,name=str_val,json=strVal,proto3" json:"str_val,omitempty"` // contains filtered or unexported fields }
func (*SubObject) Descriptor
deprecated
added in
v0.3.0
func (*SubObject) Preprocess ¶ added in v0.3.0
func (*SubObject) ProtoMessage ¶ added in v0.3.0
func (*SubObject) ProtoMessage()
func (*SubObject) ProtoReflect ¶ added in v0.4.2
func (x *SubObject) ProtoReflect() protoreflect.Message
type UnimplementedDemoServiceServer ¶ added in v0.4.2
type UnimplementedDemoServiceServer struct { }
UnimplementedDemoServiceServer can be embedded to have forward compatible implementations.