Documentation ¶
Overview ¶
Package proto contains the GRPC client and server definitions for our sample
Package proto is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterSampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterSampleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SampleServiceClient) error
- func RegisterSampleServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterSampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SampleServiceServer) error
- func RegisterSampleServiceServer(s grpc.ServiceRegistrar, srv SampleServiceServer)
- type DeleteThingRequest
- type SampleServiceClient
- type SampleServiceServer
- type Thing
- type ThingFilter
- type ThingList
- type UnimplementedSampleServiceServer
- func (UnimplementedSampleServiceServer) Create(context.Context, *Thing) (*Thing, error)
- func (UnimplementedSampleServiceServer) Delete(context.Context, *DeleteThingRequest) (*emptypb.Empty, error)
- func (UnimplementedSampleServiceServer) List(context.Context, *ThingFilter) (*ThingList, error)
- func (UnimplementedSampleServiceServer) Update(context.Context, *Thing) (*Thing, error)
- type UnsafeSampleServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_sample_proto protoreflect.FileDescriptor
var SampleService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "proto.SampleService", HandlerType: (*SampleServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _SampleService_Create_Handler, }, { MethodName: "Update", Handler: _SampleService_Update_Handler, }, { MethodName: "List", Handler: _SampleService_List_Handler, }, { MethodName: "Delete", Handler: _SampleService_Delete_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "sample.proto", }
SampleService_ServiceDesc is the grpc.ServiceDesc for SampleService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterSampleServiceHandler ¶
func RegisterSampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterSampleServiceHandler registers the http handlers for service SampleService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterSampleServiceHandlerClient ¶
func RegisterSampleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SampleServiceClient) error
RegisterSampleServiceHandlerClient registers the http handlers for service SampleService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SampleServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SampleServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SampleServiceClient" to call the correct interceptors.
func RegisterSampleServiceHandlerFromEndpoint ¶
func RegisterSampleServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterSampleServiceHandlerFromEndpoint is same as RegisterSampleServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSampleServiceHandlerServer ¶
func RegisterSampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SampleServiceServer) error
RegisterSampleServiceHandlerServer registers the http handlers for service SampleService to "mux". UnaryRPC :call SampleServiceServer 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 RegisterSampleServiceHandlerFromEndpoint instead.
func RegisterSampleServiceServer ¶
func RegisterSampleServiceServer(s grpc.ServiceRegistrar, srv SampleServiceServer)
Types ¶
type DeleteThingRequest ¶
type DeleteThingRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*DeleteThingRequest) Descriptor
deprecated
func (*DeleteThingRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteThingRequest.ProtoReflect.Descriptor instead.
func (*DeleteThingRequest) GetId ¶
func (x *DeleteThingRequest) GetId() string
func (*DeleteThingRequest) ProtoMessage ¶
func (*DeleteThingRequest) ProtoMessage()
func (*DeleteThingRequest) ProtoReflect ¶
func (x *DeleteThingRequest) ProtoReflect() protoreflect.Message
func (*DeleteThingRequest) Reset ¶
func (x *DeleteThingRequest) Reset()
func (*DeleteThingRequest) String ¶
func (x *DeleteThingRequest) String() string
type SampleServiceClient ¶
type SampleServiceClient interface { Create(ctx context.Context, in *Thing, opts ...grpc.CallOption) (*Thing, error) Update(ctx context.Context, in *Thing, opts ...grpc.CallOption) (*Thing, error) List(ctx context.Context, in *ThingFilter, opts ...grpc.CallOption) (*ThingList, error) Delete(ctx context.Context, in *DeleteThingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) }
SampleServiceClient is the client API for SampleService 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 NewSampleServiceClient ¶
func NewSampleServiceClient(cc grpc.ClientConnInterface) SampleServiceClient
type SampleServiceServer ¶
type SampleServiceServer interface { Create(context.Context, *Thing) (*Thing, error) Update(context.Context, *Thing) (*Thing, error) List(context.Context, *ThingFilter) (*ThingList, error) Delete(context.Context, *DeleteThingRequest) (*emptypb.Empty, error) // contains filtered or unexported methods }
SampleServiceServer is the server API for SampleService service. All implementations must embed UnimplementedSampleServiceServer for forward compatibility
type Thing ¶
type Thing struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Field1 string `protobuf:"bytes,2,opt,name=field1,proto3" json:"field1,omitempty"` Field2 string `protobuf:"bytes,3,opt,name=field2,proto3" json:"field2,omitempty"` // contains filtered or unexported fields }
func (*Thing) Descriptor
deprecated
func (*Thing) ProtoMessage ¶
func (*Thing) ProtoMessage()
func (*Thing) ProtoReflect ¶
func (x *Thing) ProtoReflect() protoreflect.Message
type ThingFilter ¶
type ThingFilter struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*ThingFilter) Descriptor
deprecated
func (*ThingFilter) Descriptor() ([]byte, []int)
Deprecated: Use ThingFilter.ProtoReflect.Descriptor instead.
func (*ThingFilter) GetId ¶
func (x *ThingFilter) GetId() string
func (*ThingFilter) ProtoMessage ¶
func (*ThingFilter) ProtoMessage()
func (*ThingFilter) ProtoReflect ¶
func (x *ThingFilter) ProtoReflect() protoreflect.Message
func (*ThingFilter) Reset ¶
func (x *ThingFilter) Reset()
func (*ThingFilter) String ¶
func (x *ThingFilter) String() string
type ThingList ¶
type ThingList struct { Items []*Thing `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func (*ThingList) Descriptor
deprecated
func (*ThingList) ProtoMessage ¶
func (*ThingList) ProtoMessage()
func (*ThingList) ProtoReflect ¶
func (x *ThingList) ProtoReflect() protoreflect.Message
type UnimplementedSampleServiceServer ¶
type UnimplementedSampleServiceServer struct { }
UnimplementedSampleServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedSampleServiceServer) Delete ¶
func (UnimplementedSampleServiceServer) Delete(context.Context, *DeleteThingRequest) (*emptypb.Empty, error)
func (UnimplementedSampleServiceServer) List ¶
func (UnimplementedSampleServiceServer) List(context.Context, *ThingFilter) (*ThingList, error)
type UnsafeSampleServiceServer ¶
type UnsafeSampleServiceServer interface {
// contains filtered or unexported methods
}
UnsafeSampleServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SampleServiceServer will result in compilation errors.