pbgen

package
v0.0.0-...-a6fa6aa Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package pbgen is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package pbgen is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Greeter_Greet_FullMethodName       = "/proto.Greeter/Greet"
	Greeter_GreetStream_FullMethodName = "/proto.Greeter/GreetStream"
	Greeter_GreetRecord_FullMethodName = "/proto.Greeter/GreetRecord"
)
View Source
const (
	TagService_GetTags_FullMethodName = "/proto.TagService/GetTags"
)

Variables

View Source
var File_common_proto protoreflect.FileDescriptor
View Source
var File_greet_proto protoreflect.FileDescriptor
View Source
var Greeter_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.Greeter",
	HandlerType: (*GreeterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Greet",
			Handler:    _Greeter_Greet_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GreetStream",
			Handler:       _Greeter_GreetStream_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GreetRecord",
			Handler:       _Greeter_GreetRecord_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "greet.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 TagService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.TagService",
	HandlerType: (*TagServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetTags",
			Handler:    _TagService_GetTags_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "tag.proto",
}

TagService_ServiceDesc is the grpc.ServiceDesc for TagService 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 RegisterTagServiceHandler

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

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

func RegisterTagServiceHandlerClient

func RegisterTagServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TagServiceClient) error

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

func RegisterTagServiceHandlerFromEndpoint

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

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

func RegisterTagServiceHandlerServer

func RegisterTagServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TagServiceServer) error

RegisterTagServiceHandlerServer registers the http handlers for service TagService to "mux". UnaryRPC :call TagServiceServer 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 RegisterTagServiceHandlerFromEndpoint instead.

func RegisterTagServiceServer

func RegisterTagServiceServer(s grpc.ServiceRegistrar, srv TagServiceServer)

Types

type CommonError

type CommonError struct {
	Code    int32      `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string     `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Detail  *anypb.Any `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"`
	// contains filtered or unexported fields
}

func (*CommonError) Descriptor deprecated

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

Deprecated: Use CommonError.ProtoReflect.Descriptor instead.

func (*CommonError) GetCode

func (x *CommonError) GetCode() int32

func (*CommonError) GetDetail

func (x *CommonError) GetDetail() *anypb.Any

func (*CommonError) GetMessage

func (x *CommonError) GetMessage() string

func (*CommonError) ProtoMessage

func (*CommonError) ProtoMessage()

func (*CommonError) ProtoReflect

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

func (*CommonError) Reset

func (x *CommonError) Reset()

func (*CommonError) String

func (x *CommonError) String() string

type GetTagsReply

type GetTagsReply struct {
	Data  []*Tag `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
	Pager *Pager `protobuf:"bytes,2,opt,name=pager,proto3" json:"pager,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTagsReply) Descriptor deprecated

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

Deprecated: Use GetTagsReply.ProtoReflect.Descriptor instead.

func (*GetTagsReply) GetData

func (x *GetTagsReply) GetData() []*Tag

func (*GetTagsReply) GetPager

func (x *GetTagsReply) GetPager() *Pager

func (*GetTagsReply) ProtoMessage

func (*GetTagsReply) ProtoMessage()

func (*GetTagsReply) ProtoReflect

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

func (*GetTagsReply) Reset

func (x *GetTagsReply) Reset()

func (*GetTagsReply) String

func (x *GetTagsReply) String() string

type GetTagsRequest

type GetTagsRequest struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	State uint32 `protobuf:"varint,2,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTagsRequest) Descriptor deprecated

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

Deprecated: Use GetTagsRequest.ProtoReflect.Descriptor instead.

func (*GetTagsRequest) GetName

func (x *GetTagsRequest) GetName() string

func (*GetTagsRequest) GetState

func (x *GetTagsRequest) GetState() uint32

func (*GetTagsRequest) ProtoMessage

func (*GetTagsRequest) ProtoMessage()

func (*GetTagsRequest) ProtoReflect

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

func (*GetTagsRequest) Reset

func (x *GetTagsRequest) Reset()

func (*GetTagsRequest) String

func (x *GetTagsRequest) String() string

type GreetRequest

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

func (*GreetRequest) Descriptor deprecated

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

Deprecated: Use GreetRequest.ProtoReflect.Descriptor instead.

func (*GreetRequest) GetName

func (x *GreetRequest) GetName() string

func (*GreetRequest) ProtoMessage

func (*GreetRequest) ProtoMessage()

func (*GreetRequest) ProtoReflect

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

func (*GreetRequest) Reset

func (x *GreetRequest) Reset()

func (*GreetRequest) String

func (x *GreetRequest) String() string

type GreetResponse

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

func (*GreetResponse) Descriptor deprecated

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

Deprecated: Use GreetResponse.ProtoReflect.Descriptor instead.

func (*GreetResponse) GetMessage

func (x *GreetResponse) GetMessage() string

func (*GreetResponse) ProtoMessage

func (*GreetResponse) ProtoMessage()

func (*GreetResponse) ProtoReflect

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

func (*GreetResponse) Reset

func (x *GreetResponse) Reset()

func (*GreetResponse) String

func (x *GreetResponse) String() string

type GreeterClient

type GreeterClient interface {
	Greet(ctx context.Context, in *GreetRequest, opts ...grpc.CallOption) (*GreetResponse, error)
	GreetStream(ctx context.Context, in *GreetRequest, opts ...grpc.CallOption) (Greeter_GreetStreamClient, error)
	GreetRecord(ctx context.Context, opts ...grpc.CallOption) (Greeter_GreetRecordClient, 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 {
	Greet(context.Context, *GreetRequest) (*GreetResponse, error)
	GreetStream(*GreetRequest, Greeter_GreetStreamServer) error
	GreetRecord(Greeter_GreetRecordServer) error
	// contains filtered or unexported methods
}

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

type Greeter_GreetRecordClient

type Greeter_GreetRecordClient interface {
	Send(*GreetRequest) error
	CloseAndRecv() (*GreetResponse, error)
	grpc.ClientStream
}

type Greeter_GreetRecordServer

type Greeter_GreetRecordServer interface {
	SendAndClose(*GreetResponse) error
	Recv() (*GreetRequest, error)
	grpc.ServerStream
}

type Greeter_GreetStreamClient

type Greeter_GreetStreamClient interface {
	Recv() (*GreetResponse, error)
	grpc.ClientStream
}

type Greeter_GreetStreamServer

type Greeter_GreetStreamServer interface {
	Send(*GreetResponse) error
	grpc.ServerStream
}

type Pager

type Pager struct {
	Page  int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
	Size  int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	Total int64 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"`
	// contains filtered or unexported fields
}

func (*Pager) Descriptor deprecated

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

Deprecated: Use Pager.ProtoReflect.Descriptor instead.

func (*Pager) GetPage

func (x *Pager) GetPage() int64

func (*Pager) GetSize

func (x *Pager) GetSize() int64

func (*Pager) GetTotal

func (x *Pager) GetTotal() int64

func (*Pager) ProtoMessage

func (*Pager) ProtoMessage()

func (*Pager) ProtoReflect

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

func (*Pager) Reset

func (x *Pager) Reset()

func (*Pager) String

func (x *Pager) String() string

type Tag

type Tag struct {
	Id    int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name  string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	State uint32 `protobuf:"varint,3,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*Tag) Descriptor deprecated

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

Deprecated: Use Tag.ProtoReflect.Descriptor instead.

func (*Tag) GetId

func (x *Tag) GetId() int64

func (*Tag) GetName

func (x *Tag) GetName() string

func (*Tag) GetState

func (x *Tag) GetState() uint32

func (*Tag) ProtoMessage

func (*Tag) ProtoMessage()

func (*Tag) ProtoReflect

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

func (*Tag) Reset

func (x *Tag) Reset()

func (*Tag) String

func (x *Tag) String() string

type TagServiceClient

type TagServiceClient interface {
	GetTags(ctx context.Context, in *GetTagsRequest, opts ...grpc.CallOption) (*GetTagsReply, error)
}

TagServiceClient is the client API for TagService 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 NewTagServiceClient

func NewTagServiceClient(cc grpc.ClientConnInterface) TagServiceClient

type TagServiceServer

type TagServiceServer interface {
	GetTags(context.Context, *GetTagsRequest) (*GetTagsReply, error)
	// contains filtered or unexported methods
}

TagServiceServer is the server API for TagService service. All implementations must embed UnimplementedTagServiceServer for forward compatibility

type UnimplementedGreeterServer

type UnimplementedGreeterServer struct {
}

UnimplementedGreeterServer must be embedded to have forward compatible implementations.

func (UnimplementedGreeterServer) Greet

func (UnimplementedGreeterServer) GreetRecord

func (UnimplementedGreeterServer) GreetStream

type UnimplementedTagServiceServer

type UnimplementedTagServiceServer struct {
}

UnimplementedTagServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedTagServiceServer) GetTags

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 UnsafeTagServiceServer

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

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

Jump to

Keyboard shortcuts

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