proto

package
v0.0.0-...-120b74a Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 16 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 (
	Gender_name = map[int32]string{
		0: "GENDER_UNKNOWN",
		1: "GENDER_MALE",
		2: "GENDER_FEMALE",
	}
	Gender_value = map[string]int32{
		"GENDER_UNKNOWN": 0,
		"GENDER_MALE":    1,
		"GENDER_FEMALE":  2,
	}
)

Enum value maps for Gender.

View Source
var File_helloworld_proto protoreflect.FileDescriptor
View Source
var File_proto_import_proto protoreflect.FileDescriptor
View Source
var File_proto_src_proto protoreflect.FileDescriptor
View Source
var Greeter_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "helloworld.Greeter",
	HandlerType: (*GreeterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SayHello",
			Handler:    _Greeter_SayHello_Handler,
		},
		{
			MethodName: "Plus",
			Handler:    _Greeter_Plus_Handler,
		},
		{
			MethodName: "SayHelloAfterDelay",
			Handler:    _Greeter_SayHelloAfterDelay_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SayHelloServerStream",
			Handler:       _Greeter_SayHelloServerStream_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "SayHelloClientStream",
			Handler:       _Greeter_SayHelloClientStream_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "SayHelloBidirectionalStream",
			Handler:       _Greeter_SayHelloBidirectionalStream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "helloworld.proto",
}

Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var TestImport_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "helloworld.TestImport",
	HandlerType: (*TestImportServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Run",
			Handler:    _TestImport_Run_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/src.proto",
}

TestImport_ServiceDesc is the grpc.ServiceDesc for TestImport service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterGreeterHandler

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

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

func RegisterGreeterHandlerClient

func RegisterGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterClient) error

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

func RegisterGreeterHandlerFromEndpoint

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

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

func RegisterGreeterHandlerServer

func RegisterGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServer) error

RegisterGreeterHandlerServer registers the http handlers for service Greeter to "mux". UnaryRPC :call GreeterServer 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 RegisterGreeterHandlerFromEndpoint instead.

func RegisterGreeterServer

func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)

func RegisterTestImportServer

func RegisterTestImportServer(s grpc.ServiceRegistrar, srv TestImportServer)

Types

type Gender

type Gender int32
const (
	Gender_GENDER_UNKNOWN Gender = 0
	Gender_GENDER_MALE    Gender = 1
	Gender_GENDER_FEMALE  Gender = 2
)

func (Gender) Descriptor

func (Gender) Descriptor() protoreflect.EnumDescriptor

func (Gender) Enum

func (x Gender) Enum() *Gender

func (Gender) EnumDescriptor deprecated

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

Deprecated: Use Gender.Descriptor instead.

func (Gender) Number

func (x Gender) Number() protoreflect.EnumNumber

func (Gender) String

func (x Gender) String() string

func (Gender) Type

func (Gender) Type() protoreflect.EnumType

type GreeterClient

type GreeterClient interface {
	// Unary RPC.
	SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
	Plus(ctx context.Context, in *PlusRequest, opts ...grpc.CallOption) (*PlusReply, error)
	SayHelloAfterDelay(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
	// Server side streaming.
	SayHelloServerStream(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (Greeter_SayHelloServerStreamClient, error)
	// Client side streaming.
	SayHelloClientStream(ctx context.Context, opts ...grpc.CallOption) (Greeter_SayHelloClientStreamClient, error)
	// Bidirectional streaming.
	SayHelloBidirectionalStream(ctx context.Context, opts ...grpc.CallOption) (Greeter_SayHelloBidirectionalStreamClient, error)
}

GreeterClient is the client API for Greeter 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 NewGreeterClient

func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient

type GreeterServer

type GreeterServer interface {
	// Unary RPC.
	SayHello(context.Context, *HelloRequest) (*HelloReply, error)
	Plus(context.Context, *PlusRequest) (*PlusReply, error)
	SayHelloAfterDelay(context.Context, *HelloRequest) (*HelloReply, error)
	// Server side streaming.
	SayHelloServerStream(*HelloRequest, Greeter_SayHelloServerStreamServer) error
	// Client side streaming.
	SayHelloClientStream(Greeter_SayHelloClientStreamServer) error
	// Bidirectional streaming.
	SayHelloBidirectionalStream(Greeter_SayHelloBidirectionalStreamServer) error
	// contains filtered or unexported methods
}

GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility

type Greeter_SayHelloBidirectionalStreamClient

type Greeter_SayHelloBidirectionalStreamClient interface {
	Send(*HelloRequest) error
	Recv() (*HelloReply, error)
	grpc.ClientStream
}

type Greeter_SayHelloBidirectionalStreamServer

type Greeter_SayHelloBidirectionalStreamServer interface {
	Send(*HelloReply) error
	Recv() (*HelloRequest, error)
	grpc.ServerStream
}

type Greeter_SayHelloClientStreamClient

type Greeter_SayHelloClientStreamClient interface {
	Send(*HelloRequest) error
	CloseAndRecv() (*HelloReply, error)
	grpc.ClientStream
}

type Greeter_SayHelloClientStreamServer

type Greeter_SayHelloClientStreamServer interface {
	SendAndClose(*HelloReply) error
	Recv() (*HelloRequest, error)
	grpc.ServerStream
}

type Greeter_SayHelloServerStreamClient

type Greeter_SayHelloServerStreamClient interface {
	Recv() (*HelloReply, error)
	grpc.ClientStream
}

type Greeter_SayHelloServerStreamServer

type Greeter_SayHelloServerStreamServer interface {
	Send(*HelloReply) error
	grpc.ServerStream
}

type HelloReply

type HelloReply struct {
	Message string   `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Items   []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	Gender  Gender   `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloReply) Descriptor deprecated

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

Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.

func (*HelloReply) GetGender

func (x *HelloReply) GetGender() Gender

func (*HelloReply) GetItems

func (x *HelloReply) GetItems() []string

func (*HelloReply) GetMessage

func (x *HelloReply) GetMessage() string

func (*HelloReply) ProtoMessage

func (*HelloReply) ProtoMessage()

func (*HelloReply) ProtoReflect

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

func (*HelloReply) Reset

func (x *HelloReply) Reset()

func (*HelloReply) String

func (x *HelloReply) String() string

type HelloRequest

type HelloRequest struct {
	Name   string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Items  []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	Gender Gender   `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"`
	Person *Person  `protobuf:"bytes,4,opt,name=person,proto3" json:"person,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloRequest) Descriptor deprecated

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

Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.

func (*HelloRequest) GetGender

func (x *HelloRequest) GetGender() Gender

func (*HelloRequest) GetItems

func (x *HelloRequest) GetItems() []string

func (*HelloRequest) GetName

func (x *HelloRequest) GetName() string

func (*HelloRequest) GetPerson

func (x *HelloRequest) GetPerson() *Person

func (*HelloRequest) ProtoMessage

func (*HelloRequest) ProtoMessage()

func (*HelloRequest) ProtoReflect

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

func (*HelloRequest) Reset

func (x *HelloRequest) Reset()

func (*HelloRequest) String

func (x *HelloRequest) String() string

type Person

type Person struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Age  int32  `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
	// contains filtered or unexported fields
}

func (*Person) Descriptor deprecated

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

Deprecated: Use Person.ProtoReflect.Descriptor instead.

func (*Person) GetAge

func (x *Person) GetAge() int32

func (*Person) GetName

func (x *Person) GetName() string

func (*Person) ProtoMessage

func (*Person) ProtoMessage()

func (*Person) ProtoReflect

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

func (*Person) Reset

func (x *Person) Reset()

func (*Person) String

func (x *Person) String() string

type PlusReply

type PlusReply struct {
	Result int64 `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*PlusReply) Descriptor deprecated

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

Deprecated: Use PlusReply.ProtoReflect.Descriptor instead.

func (*PlusReply) GetResult

func (x *PlusReply) GetResult() int64

func (*PlusReply) ProtoMessage

func (*PlusReply) ProtoMessage()

func (*PlusReply) ProtoReflect

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

func (*PlusReply) Reset

func (x *PlusReply) Reset()

func (*PlusReply) String

func (x *PlusReply) String() string

type PlusRequest

type PlusRequest struct {
	A int64 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"`
	B int64 `protobuf:"varint,2,opt,name=b,proto3" json:"b,omitempty"`
	// contains filtered or unexported fields
}

func (*PlusRequest) Descriptor deprecated

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

Deprecated: Use PlusRequest.ProtoReflect.Descriptor instead.

func (*PlusRequest) GetA

func (x *PlusRequest) GetA() int64

func (*PlusRequest) GetB

func (x *PlusRequest) GetB() int64

func (*PlusRequest) ProtoMessage

func (*PlusRequest) ProtoMessage()

func (*PlusRequest) ProtoReflect

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

func (*PlusRequest) Reset

func (x *PlusRequest) Reset()

func (*PlusRequest) String

func (x *PlusRequest) String() string

type Request

type Request struct {
	User *User  `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Body string `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetBody

func (x *Request) GetBody() string

func (*Request) GetUser

func (x *Request) GetUser() *User

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

type Response

type Response struct {
	Body string `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetBody

func (x *Response) GetBody() string

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

type TestImportClient

type TestImportClient interface {
	Run(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

TestImportClient is the client API for TestImport 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 NewTestImportClient

func NewTestImportClient(cc grpc.ClientConnInterface) TestImportClient

type TestImportServer

type TestImportServer interface {
	Run(context.Context, *Request) (*Response, error)
	// contains filtered or unexported methods
}

TestImportServer is the server API for TestImport service. All implementations must embed UnimplementedTestImportServer for forward compatibility

type UnimplementedGreeterServer

type UnimplementedGreeterServer struct {
}

UnimplementedGreeterServer must be embedded to have forward compatible implementations.

func (UnimplementedGreeterServer) Plus

func (UnimplementedGreeterServer) SayHello

func (UnimplementedGreeterServer) SayHelloAfterDelay

func (UnimplementedGreeterServer) SayHelloBidirectionalStream

func (UnimplementedGreeterServer) SayHelloClientStream

func (UnimplementedGreeterServer) SayHelloServerStream

type UnimplementedTestImportServer

type UnimplementedTestImportServer struct {
}

UnimplementedTestImportServer must be embedded to have forward compatible implementations.

func (UnimplementedTestImportServer) Run

type UnsafeGreeterServer

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

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

type UnsafeTestImportServer

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

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

type User

type User struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetName

func (x *User) GetName() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

Jump to

Keyboard shortcuts

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