proto

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Custom.ProtoReflect.Descriptor instead.

func (*Custom) GetDoItYourself

func (x *Custom) GetDoItYourself() string

func (*Custom) Preprocess

func (m *Custom) Preprocess() error

func (*Custom) ProtoMessage

func (*Custom) ProtoMessage()

func (*Custom) ProtoReflect added in v0.4.2

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

func (*Custom) Reset

func (x *Custom) Reset()

func (*Custom) String

func (x *Custom) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Demo.ProtoReflect.Descriptor instead.

func (*Demo) GetClearinheritance added in v0.3.3

func (x *Demo) GetClearinheritance() []string

func (*Demo) GetIgnored

func (x *Demo) GetIgnored() int32

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) GetMyMap added in v0.3.2

func (x *Demo) GetMyMap() map[string]string

func (*Demo) GetNonepreprocessRepeated added in v0.3.3

func (x *Demo) GetNonepreprocessRepeated() []string

func (*Demo) GetPreprocessRepeatedField2 added in v0.3.3

func (x *Demo) GetPreprocessRepeatedField2() []string

func (*Demo) GetPreprocessedField

func (x *Demo) GetPreprocessedField() string

func (*Demo) GetPreprocessedRepeatedField

func (x *Demo) GetPreprocessedRepeatedField() []string

func (*Demo) GetSub added in v0.3.0

func (x *Demo) GetSub() *SubObject

func (*Demo) GetSubRepeated added in v0.3.0

func (x *Demo) GetSubRepeated() []*SubObject

func (*Demo) GetTime added in v0.4.2

func (x *Demo) GetTime() *timestamppb.Timestamp

func (*Demo) Preprocess

func (m *Demo) Preprocess() error

func (*Demo) ProtoMessage

func (*Demo) ProtoMessage()

func (*Demo) ProtoReflect added in v0.4.2

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

func (*Demo) Reset

func (x *Demo) Reset()

func (*Demo) String

func (x *Demo) String() string

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.

type DemoServiceServer

type DemoServiceServer interface {
	Echo(context.Context, *Demo) (*Demo, error)
}

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) Descriptor() ([]byte, []int)

Deprecated: Use SubObject.ProtoReflect.Descriptor instead.

func (*SubObject) GetStrVal added in v0.3.0

func (x *SubObject) GetStrVal() string

func (*SubObject) Preprocess added in v0.3.0

func (m *SubObject) Preprocess() error

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

func (*SubObject) Reset added in v0.3.0

func (x *SubObject) Reset()

func (*SubObject) String added in v0.3.0

func (x *SubObject) String() string

type UnimplementedDemoServiceServer added in v0.4.2

type UnimplementedDemoServiceServer struct {
}

UnimplementedDemoServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedDemoServiceServer) Echo added in v0.4.2

Jump to

Keyboard shortcuts

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