test_grpc.pb.go

test_grpc.pb.go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.19.4
// source: test.proto

package pb

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

// FindClassClient is the client API for FindClass 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 FindClassClient interface {
	MyClass(ctx context.Context, in *Student, opts ...grpc.CallOption) (*Class, error)
}

type findClassClient struct {
	cc grpc.ClientConnInterface
}

func NewFindClassClient(cc grpc.ClientConnInterface) FindClassClient {
	return &findClassClient{cc}
}

func (c *findClassClient) MyClass(ctx context.Context, in *Student, opts ...grpc.CallOption) (*Class, error) {
	out := new(Class)
	err := c.cc.Invoke(ctx, "/pb.FindClass/MyClass", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// FindClassServer is the server API for FindClass service.
// All implementations must embed UnimplementedFindClassServer
// for forward compatibility
type FindClassServer interface {
	MyClass(context.Context, *Student) (*Class, error)
	mustEmbedUnimplementedFindClassServer()
}

// UnimplementedFindClassServer must be embedded to have forward compatible implementations.
type UnimplementedFindClassServer struct {
}

func (UnimplementedFindClassServer) MyClass(context.Context, *Student) (*Class, error) {
	return nil, status.Errorf(codes.Unimplemented, "method MyClass not implemented")
}
func (UnimplementedFindClassServer) mustEmbedUnimplementedFindClassServer() {}

// UnsafeFindClassServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FindClassServer will
// result in compilation errors.
type UnsafeFindClassServer interface {
	mustEmbedUnimplementedFindClassServer()
}

func RegisterFindClassServer(s grpc.ServiceRegistrar, srv FindClassServer) {
	s.RegisterService(&FindClass_ServiceDesc, srv)
}

func _FindClass_MyClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Student)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(FindClassServer).MyClass(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/pb.FindClass/MyClass",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(FindClassServer).MyClass(ctx, req.(*Student))
	}
	return interceptor(ctx, in, info, handler)
}

// FindClass_ServiceDesc is the grpc.ServiceDesc for FindClass service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FindClass_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pb.FindClass",
	HandlerType: (*FindClassServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "MyClass",
			Handler:    _FindClass_MyClass_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "test.proto",
}

  

posted @ 2022-02-24 17:31  屁桃  阅读(60)  评论(0编辑  收藏  举报