Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterExampleHTTPServer(s *http.Server, srv ExampleHTTPServer)
- func RegisterExampleServer(s grpc.ServiceRegistrar, srv ExampleServer)
- type AddRequest
- func (*AddRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddRequest) GetId() uint32
- func (x *AddRequest) GetName() string
- func (*AddRequest) ProtoMessage()
- func (x *AddRequest) ProtoReflect() protoreflect.Message
- func (x *AddRequest) Reset()
- func (x *AddRequest) String() string
- func (this *AddRequest) Validate() error
- type CommonResponse
- func (*CommonResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CommonResponse) GetCode() int64
- func (x *CommonResponse) GetData() *Empty
- func (x *CommonResponse) GetDesc() string
- func (*CommonResponse) ProtoMessage()
- func (x *CommonResponse) ProtoReflect() protoreflect.Message
- func (x *CommonResponse) Reset()
- func (x *CommonResponse) String() string
- func (this *CommonResponse) Validate() error
- type Empty
- type ExampleClient
- type ExampleHTTPClient
- type ExampleHTTPClientImpl
- type ExampleHTTPServer
- type ExampleServer
- type GetRequest
- type UnimplementedExampleServer
- type UnsafeExampleServer
Constants ¶
const OperationExampleAdd = "/example.Example/Add"
const OperationExampleGet = "/example.Example/Get"
Variables ¶
var Example_ServiceDesc = grpc.ServiceDesc{ ServiceName: "example.Example", HandlerType: (*ExampleServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Add", Handler: _Example_Add_Handler, }, { MethodName: "Get", Handler: _Example_Get_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/example/example.proto", }
Example_ServiceDesc is the grpc.ServiceDesc for Example service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_proto_example_example_proto protoreflect.FileDescriptor
Functions ¶
func RegisterExampleHTTPServer ¶ added in v1.0.2
func RegisterExampleHTTPServer(s *http.Server, srv ExampleHTTPServer)
func RegisterExampleServer ¶
func RegisterExampleServer(s grpc.ServiceRegistrar, srv ExampleServer)
Types ¶
type AddRequest ¶
type AddRequest struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*AddRequest) Descriptor
deprecated
func (*AddRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddRequest.ProtoReflect.Descriptor instead.
func (*AddRequest) GetId ¶
func (x *AddRequest) GetId() uint32
func (*AddRequest) GetName ¶
func (x *AddRequest) GetName() string
func (*AddRequest) ProtoMessage ¶
func (*AddRequest) ProtoMessage()
func (*AddRequest) ProtoReflect ¶
func (x *AddRequest) ProtoReflect() protoreflect.Message
func (*AddRequest) Reset ¶
func (x *AddRequest) Reset()
func (*AddRequest) String ¶
func (x *AddRequest) String() string
func (*AddRequest) Validate ¶
func (this *AddRequest) Validate() error
type CommonResponse ¶
type CommonResponse struct { Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty"` Data *Empty `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*CommonResponse) Descriptor
deprecated
func (*CommonResponse) Descriptor() ([]byte, []int)
Deprecated: Use CommonResponse.ProtoReflect.Descriptor instead.
func (*CommonResponse) GetCode ¶
func (x *CommonResponse) GetCode() int64
func (*CommonResponse) GetData ¶
func (x *CommonResponse) GetData() *Empty
func (*CommonResponse) GetDesc ¶
func (x *CommonResponse) GetDesc() string
func (*CommonResponse) ProtoMessage ¶
func (*CommonResponse) ProtoMessage()
func (*CommonResponse) ProtoReflect ¶
func (x *CommonResponse) ProtoReflect() protoreflect.Message
func (*CommonResponse) Reset ¶
func (x *CommonResponse) Reset()
func (*CommonResponse) String ¶
func (x *CommonResponse) String() string
func (*CommonResponse) Validate ¶
func (this *CommonResponse) Validate() error
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type ExampleClient ¶
type ExampleClient interface { Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*CommonResponse, error) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*CommonResponse, error) }
ExampleClient is the client API for Example 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 NewExampleClient ¶
func NewExampleClient(cc grpc.ClientConnInterface) ExampleClient
type ExampleHTTPClient ¶ added in v1.0.2
type ExampleHTTPClient interface { Add(ctx context.Context, req *AddRequest, opts ...http.CallOption) (rsp *CommonResponse, err error) Get(ctx context.Context, req *GetRequest, opts ...http.CallOption) (rsp *CommonResponse, err error) }
func NewExampleHTTPClient ¶ added in v1.0.2
func NewExampleHTTPClient(client *http.Client) ExampleHTTPClient
type ExampleHTTPClientImpl ¶ added in v1.0.2
type ExampleHTTPClientImpl struct {
// contains filtered or unexported fields
}
func (*ExampleHTTPClientImpl) Add ¶ added in v1.0.2
func (c *ExampleHTTPClientImpl) Add(ctx context.Context, in *AddRequest, opts ...http.CallOption) (*CommonResponse, error)
func (*ExampleHTTPClientImpl) Get ¶ added in v1.0.2
func (c *ExampleHTTPClientImpl) Get(ctx context.Context, in *GetRequest, opts ...http.CallOption) (*CommonResponse, error)
type ExampleHTTPServer ¶ added in v1.0.2
type ExampleHTTPServer interface { Add(context.Context, *AddRequest) (*CommonResponse, error) Get(context.Context, *GetRequest) (*CommonResponse, error) }
type ExampleServer ¶
type ExampleServer interface { Add(context.Context, *AddRequest) (*CommonResponse, error) Get(context.Context, *GetRequest) (*CommonResponse, error) // contains filtered or unexported methods }
ExampleServer is the server API for Example service. All implementations must embed UnimplementedExampleServer for forward compatibility
type GetRequest ¶
type GetRequest struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GetRequest) Descriptor
deprecated
func (*GetRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.
func (*GetRequest) GetId ¶
func (x *GetRequest) GetId() uint32
func (*GetRequest) ProtoMessage ¶
func (*GetRequest) ProtoMessage()
func (*GetRequest) ProtoReflect ¶
func (x *GetRequest) ProtoReflect() protoreflect.Message
func (*GetRequest) Reset ¶
func (x *GetRequest) Reset()
func (*GetRequest) String ¶
func (x *GetRequest) String() string
func (*GetRequest) Validate ¶
func (this *GetRequest) Validate() error
type UnimplementedExampleServer ¶
type UnimplementedExampleServer struct { }
UnimplementedExampleServer must be embedded to have forward compatible implementations.
func (UnimplementedExampleServer) Add ¶
func (UnimplementedExampleServer) Add(context.Context, *AddRequest) (*CommonResponse, error)
func (UnimplementedExampleServer) Get ¶
func (UnimplementedExampleServer) Get(context.Context, *GetRequest) (*CommonResponse, error)
type UnsafeExampleServer ¶
type UnsafeExampleServer interface {
// contains filtered or unexported methods
}
UnsafeExampleServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ExampleServer will result in compilation errors.