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
- Variables
- func RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterClient) error
- func RegisterGreeterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServer) error
- func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
- func RegisterTagServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTagServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TagServiceClient) error
- func RegisterTagServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTagServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TagServiceServer) error
- func RegisterTagServiceServer(s grpc.ServiceRegistrar, srv TagServiceServer)
- type CommonError
- func (*CommonError) Descriptor() ([]byte, []int)deprecated
- func (x *CommonError) GetCode() int32
- func (x *CommonError) GetDetail() *anypb.Any
- func (x *CommonError) GetMessage() string
- func (*CommonError) ProtoMessage()
- func (x *CommonError) ProtoReflect() protoreflect.Message
- func (x *CommonError) Reset()
- func (x *CommonError) String() string
- type GetTagsReply
- func (*GetTagsReply) Descriptor() ([]byte, []int)deprecated
- func (x *GetTagsReply) GetData() []*Tag
- func (x *GetTagsReply) GetPager() *Pager
- func (*GetTagsReply) ProtoMessage()
- func (x *GetTagsReply) ProtoReflect() protoreflect.Message
- func (x *GetTagsReply) Reset()
- func (x *GetTagsReply) String() string
- type GetTagsRequest
- func (*GetTagsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetTagsRequest) GetName() string
- func (x *GetTagsRequest) GetState() uint32
- func (*GetTagsRequest) ProtoMessage()
- func (x *GetTagsRequest) ProtoReflect() protoreflect.Message
- func (x *GetTagsRequest) Reset()
- func (x *GetTagsRequest) String() string
- type GreetRequest
- type GreetResponse
- type GreeterClient
- type GreeterServer
- type Greeter_GreetRecordClient
- type Greeter_GreetRecordServer
- type Greeter_GreetStreamClient
- type Greeter_GreetStreamServer
- type Pager
- type Tag
- type TagServiceClient
- type TagServiceServer
- type UnimplementedGreeterServer
- func (UnimplementedGreeterServer) Greet(context.Context, *GreetRequest) (*GreetResponse, error)
- func (UnimplementedGreeterServer) GreetRecord(grpc.ClientStreamingServer[GreetRequest, GreetResponse]) error
- func (UnimplementedGreeterServer) GreetStream(*GreetRequest, grpc.ServerStreamingServer[GreetResponse]) error
- type UnimplementedTagServiceServer
- type UnsafeGreeterServer
- type UnsafeTagServiceServer
Constants ¶
const ( Greeter_Greet_FullMethodName = "/proto.Greeter/Greet" Greeter_GreetStream_FullMethodName = "/proto.Greeter/GreetStream" Greeter_GreetRecord_FullMethodName = "/proto.Greeter/GreetRecord" )
const (
TagService_GetTags_FullMethodName = "/proto.TagService/GetTags"
)
Variables ¶
var File_common_proto protoreflect.FileDescriptor
var File_greet_proto protoreflect.FileDescriptor
var File_tag_proto protoreflect.FileDescriptor
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)
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. This client ignores the HTTP middlewares.
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. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
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. This client ignores the HTTP middlewares.
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. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
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) (grpc.ServerStreamingClient[GreetResponse], error) GreetRecord(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[GreetRequest, GreetResponse], 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, grpc.ServerStreamingServer[GreetResponse]) error GreetRecord(grpc.ClientStreamingServer[GreetRequest, GreetResponse]) 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 = grpc.ClientStreamingClient[GreetRequest, GreetResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Greeter_GreetRecordServer ¶
type Greeter_GreetRecordServer = grpc.ClientStreamingServer[GreetRequest, GreetResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Greeter_GreetStreamClient ¶
type Greeter_GreetStreamClient = grpc.ServerStreamingClient[GreetResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Greeter_GreetStreamServer ¶
type Greeter_GreetStreamServer = grpc.ServerStreamingServer[GreetResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
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) ProtoMessage ¶
func (*Pager) ProtoMessage()
func (*Pager) ProtoReflect ¶
func (x *Pager) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*Tag) ProtoMessage()
func (*Tag) ProtoReflect ¶
func (x *Tag) ProtoReflect() protoreflect.Message
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.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedGreeterServer) Greet ¶
func (UnimplementedGreeterServer) Greet(context.Context, *GreetRequest) (*GreetResponse, error)
func (UnimplementedGreeterServer) GreetRecord ¶
func (UnimplementedGreeterServer) GreetRecord(grpc.ClientStreamingServer[GreetRequest, GreetResponse]) error
func (UnimplementedGreeterServer) GreetStream ¶
func (UnimplementedGreeterServer) GreetStream(*GreetRequest, grpc.ServerStreamingServer[GreetResponse]) error
type UnimplementedTagServiceServer ¶
type UnimplementedTagServiceServer struct{}
UnimplementedTagServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedTagServiceServer) GetTags ¶
func (UnimplementedTagServiceServer) GetTags(context.Context, *GetTagsRequest) (*GetTagsReply, error)
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.