Documentation ¶
Overview ¶
Package sum is a self-registering gRPC and JSON+Swagger service definition.
It conforms to the github.com/utrack/clay/v3/transport Service interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var File_pb_sum_proto protoreflect.FileDescriptor
var Summator_ServiceDesc = grpc.ServiceDesc{ ServiceName: "sumpb.Summator", HandlerType: (*SummatorServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Sum", Handler: _Summator_Sum_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "pb/sum.proto", }
Summator_ServiceDesc is the grpc.ServiceDesc for Summator service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterSummatorServer ¶
func RegisterSummatorServer(s grpc.ServiceRegistrar, srv SummatorServer)
Types ¶
type NestedB ¶
type NestedB struct { B int64 `protobuf:"varint,1,opt,name=b,proto3" json:"b,omitempty"` // contains filtered or unexported fields }
func (*NestedB) Descriptor
deprecated
func (*NestedB) ProtoMessage ¶
func (*NestedB) ProtoMessage()
func (*NestedB) ProtoReflect ¶
func (x *NestedB) ProtoReflect() protoreflect.Message
type SumRequest ¶
type SumRequest struct { // A is the number we're adding to. Can't be zero for the sake of example. A int64 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` // B is the number we're adding. B *NestedB `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` // contains filtered or unexported fields }
SumRequest is a request for Summator service.
func (*SumRequest) Descriptor
deprecated
func (*SumRequest) Descriptor() ([]byte, []int)
Deprecated: Use SumRequest.ProtoReflect.Descriptor instead.
func (*SumRequest) GetA ¶
func (x *SumRequest) GetA() int64
func (*SumRequest) GetB ¶
func (x *SumRequest) GetB() *NestedB
func (*SumRequest) ProtoMessage ¶
func (*SumRequest) ProtoMessage()
func (*SumRequest) ProtoReflect ¶
func (x *SumRequest) ProtoReflect() protoreflect.Message
func (*SumRequest) Reset ¶
func (x *SumRequest) Reset()
func (*SumRequest) String ¶
func (x *SumRequest) String() string
type SumResponse ¶
type SumResponse struct { Sum int64 `protobuf:"varint,1,opt,name=sum,proto3" json:"sum,omitempty"` Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // contains filtered or unexported fields }
func (*SumResponse) Descriptor
deprecated
func (*SumResponse) Descriptor() ([]byte, []int)
Deprecated: Use SumResponse.ProtoReflect.Descriptor instead.
func (*SumResponse) GetError ¶
func (x *SumResponse) GetError() string
func (*SumResponse) GetSum ¶
func (x *SumResponse) GetSum() int64
func (*SumResponse) ProtoMessage ¶
func (*SumResponse) ProtoMessage()
func (*SumResponse) ProtoReflect ¶
func (x *SumResponse) ProtoReflect() protoreflect.Message
func (*SumResponse) Reset ¶
func (x *SumResponse) Reset()
func (*SumResponse) String ¶
func (x *SumResponse) String() string
type SummatorClient ¶
type SummatorClient interface {
Sum(ctx context.Context, in *SumRequest, opts ...grpc.CallOption) (*SumResponse, error)
}
SummatorClient is the client API for Summator 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 NewSummatorClient ¶
func NewSummatorClient(cc grpc.ClientConnInterface) SummatorClient
type SummatorDesc ¶
type SummatorDesc struct {
// contains filtered or unexported fields
}
SummatorDesc is a descriptor/registrator for the SummatorServer.
func NewSummatorServiceDesc ¶
func NewSummatorServiceDesc(svc SummatorServer) *SummatorDesc
NewSummatorServiceDesc creates new registrator for the SummatorServer. It implements httptransport.ConfigurableServiceDesc as well.
func (*SummatorDesc) Apply ¶
func (d *SummatorDesc) Apply(oo ...transport.DescOption)
Apply applies passed options.
func (*SummatorDesc) RegisterGRPC ¶
func (d *SummatorDesc) RegisterGRPC(s *grpc.Server)
RegisterGRPC implements service registrator interface.
func (*SummatorDesc) RegisterHTTP ¶
func (d *SummatorDesc) RegisterHTTP(mux transport.Router)
RegisterHTTP registers this service's HTTP handlers/bindings.
func (*SummatorDesc) SwaggerDef ¶
func (d *SummatorDesc) SwaggerDef(options ...swagger.Option) (result []byte)
SwaggerDef returns this file's Swagger definition.
type SummatorServer ¶
type SummatorServer interface { Sum(context.Context, *SumRequest) (*SumResponse, error) // contains filtered or unexported methods }
SummatorServer is the server API for Summator service. All implementations must embed UnimplementedSummatorServer for forward compatibility
type Summator_httpClient ¶
type Summator_httpClient struct {
// contains filtered or unexported fields
}
func NewSummatorHTTPClient ¶
func NewSummatorHTTPClient(c *http.Client, addr string) *Summator_httpClient
NewSummatorHTTPClient creates new HTTP client for SummatorServer. Pass addr in format "http://host[:port]".
func (*Summator_httpClient) Sum ¶
func (c *Summator_httpClient) Sum(ctx context.Context, in *SumRequest, opts ...grpc.CallOption) (*SumResponse, error)
type UnimplementedSummatorServer ¶
type UnimplementedSummatorServer struct { }
UnimplementedSummatorServer must be embedded to have forward compatible implementations.
func (UnimplementedSummatorServer) Sum ¶
func (UnimplementedSummatorServer) Sum(context.Context, *SumRequest) (*SumResponse, error)
type UnsafeSummatorServer ¶
type UnsafeSummatorServer interface {
// contains filtered or unexported methods
}
UnsafeSummatorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SummatorServer will result in compilation errors.