You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/examples/stream/hello/hello_grpc.pb.go

266 lines
7.1 KiB

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package hello
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// HelloClient is the client API for Hello 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.
type HelloClient interface {
GetNumber(ctx context.Context, in *GetNumberRequest, opts ...grpc.CallOption) (Hello_GetNumberClient, error)
UploadLog(ctx context.Context, opts ...grpc.CallOption) (Hello_UploadLogClient, error)
Chat(ctx context.Context, opts ...grpc.CallOption) (Hello_ChatClient, error)
}
type helloClient struct {
cc grpc.ClientConnInterface
}
func NewHelloClient(cc grpc.ClientConnInterface) HelloClient {
return &helloClient{cc}
}
func (c *helloClient) GetNumber(ctx context.Context, in *GetNumberRequest, opts ...grpc.CallOption) (Hello_GetNumberClient, error) {
stream, err := c.cc.NewStream(ctx, &Hello_ServiceDesc.Streams[0], "/stream.hello.Hello/GetNumber", opts...)
if err != nil {
return nil, err
}
x := &helloGetNumberClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Hello_GetNumberClient interface {
Recv() (*GetNumberReply, error)
grpc.ClientStream
}
type helloGetNumberClient struct {
grpc.ClientStream
}
func (x *helloGetNumberClient) Recv() (*GetNumberReply, error) {
m := new(GetNumberReply)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *helloClient) UploadLog(ctx context.Context, opts ...grpc.CallOption) (Hello_UploadLogClient, error) {
stream, err := c.cc.NewStream(ctx, &Hello_ServiceDesc.Streams[1], "/stream.hello.Hello/UploadLog", opts...)
if err != nil {
return nil, err
}
x := &helloUploadLogClient{stream}
return x, nil
}
type Hello_UploadLogClient interface {
Send(*UploadLogRequest) error
CloseAndRecv() (*UploadLogReply, error)
grpc.ClientStream
}
type helloUploadLogClient struct {
grpc.ClientStream
}
func (x *helloUploadLogClient) Send(m *UploadLogRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *helloUploadLogClient) CloseAndRecv() (*UploadLogReply, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(UploadLogReply)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *helloClient) Chat(ctx context.Context, opts ...grpc.CallOption) (Hello_ChatClient, error) {
stream, err := c.cc.NewStream(ctx, &Hello_ServiceDesc.Streams[2], "/stream.hello.Hello/Chat", opts...)
if err != nil {
return nil, err
}
x := &helloChatClient{stream}
return x, nil
}
type Hello_ChatClient interface {
Send(*ChatRequest) error
Recv() (*ChatReply, error)
grpc.ClientStream
}
type helloChatClient struct {
grpc.ClientStream
}
func (x *helloChatClient) Send(m *ChatRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *helloChatClient) Recv() (*ChatReply, error) {
m := new(ChatReply)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// HelloServer is the service API for Hello service.
// All implementations must embed UnimplementedHelloServer
// for forward compatibility
type HelloServer interface {
GetNumber(*GetNumberRequest, Hello_GetNumberServer) error
UploadLog(Hello_UploadLogServer) error
Chat(Hello_ChatServer) error
mustEmbedUnimplementedHelloServer()
}
// UnimplementedHelloServer must be embedded to have forward compatible implementations.
type UnimplementedHelloServer struct {
}
func (UnimplementedHelloServer) GetNumber(*GetNumberRequest, Hello_GetNumberServer) error {
return status.Errorf(codes.Unimplemented, "method GetNumber not implemented")
}
func (UnimplementedHelloServer) UploadLog(Hello_UploadLogServer) error {
return status.Errorf(codes.Unimplemented, "method UploadLog not implemented")
}
func (UnimplementedHelloServer) Chat(Hello_ChatServer) error {
return status.Errorf(codes.Unimplemented, "method Chat not implemented")
}
func (UnimplementedHelloServer) mustEmbedUnimplementedHelloServer() {}
// UnsafeHelloServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to HelloServer will
// result in compilation errors.
type UnsafeHelloServer interface {
mustEmbedUnimplementedHelloServer()
}
func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer) {
s.RegisterService(&Hello_ServiceDesc, srv)
}
func _Hello_GetNumber_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(GetNumberRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(HelloServer).GetNumber(m, &helloGetNumberServer{stream})
}
type Hello_GetNumberServer interface {
Send(*GetNumberReply) error
grpc.ServerStream
}
type helloGetNumberServer struct {
grpc.ServerStream
}
func (x *helloGetNumberServer) Send(m *GetNumberReply) error {
return x.ServerStream.SendMsg(m)
}
func _Hello_UploadLog_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(HelloServer).UploadLog(&helloUploadLogServer{stream})
}
type Hello_UploadLogServer interface {
SendAndClose(*UploadLogReply) error
Recv() (*UploadLogRequest, error)
grpc.ServerStream
}
type helloUploadLogServer struct {
grpc.ServerStream
}
func (x *helloUploadLogServer) SendAndClose(m *UploadLogReply) error {
return x.ServerStream.SendMsg(m)
}
func (x *helloUploadLogServer) Recv() (*UploadLogRequest, error) {
m := new(UploadLogRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _Hello_Chat_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(HelloServer).Chat(&helloChatServer{stream})
}
type Hello_ChatServer interface {
Send(*ChatReply) error
Recv() (*ChatRequest, error)
grpc.ServerStream
}
type helloChatServer struct {
grpc.ServerStream
}
func (x *helloChatServer) Send(m *ChatReply) error {
return x.ServerStream.SendMsg(m)
}
func (x *helloChatServer) Recv() (*ChatRequest, error) {
m := new(ChatRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Hello_ServiceDesc is the grpc.ServiceDesc for Hello service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Hello_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stream.hello.Hello",
HandlerType: (*HelloServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "GetNumber",
Handler: _Hello_GetNumber_Handler,
ServerStreams: true,
},
{
StreamName: "UploadLog",
Handler: _Hello_UploadLog_Handler,
ClientStreams: true,
},
{
StreamName: "Chat",
Handler: _Hello_Chat_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "stream/hello/hello.proto",
}