protoc-gen-slc/pb/answer_grpc.pb.go

164 lines
5.6 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.30.1
// source: answer.proto
package survey
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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Answer_Submit_FullMethodName = "/survey.Answer/Submit"
Answer_BySurvey_FullMethodName = "/survey.Answer/BySurvey"
)
// AnswerClient is the client API for Answer 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 AnswerClient interface {
Submit(ctx context.Context, in *SubmitAnswerRequest, opts ...grpc.CallOption) (*StatusReply, error)
BySurvey(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*ListAnswerReply, error)
}
type answerClient struct {
cc grpc.ClientConnInterface
}
func NewAnswerClient(cc grpc.ClientConnInterface) AnswerClient {
return &answerClient{cc}
}
func (c *answerClient) Submit(ctx context.Context, in *SubmitAnswerRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Answer_Submit_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *answerClient) BySurvey(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*ListAnswerReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListAnswerReply)
err := c.cc.Invoke(ctx, Answer_BySurvey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AnswerServer is the server API for Answer service.
// All implementations must embed UnimplementedAnswerServer
// for forward compatibility.
//
// 问卷服务 - 答卷管理
type AnswerServer interface {
Submit(context.Context, *SubmitAnswerRequest) (*StatusReply, error)
BySurvey(context.Context, *IdentRequest) (*ListAnswerReply, error)
mustEmbedUnimplementedAnswerServer()
}
// UnimplementedAnswerServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAnswerServer struct{}
func (UnimplementedAnswerServer) Submit(context.Context, *SubmitAnswerRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Submit not implemented")
}
func (UnimplementedAnswerServer) BySurvey(context.Context, *IdentRequest) (*ListAnswerReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method BySurvey not implemented")
}
func (UnimplementedAnswerServer) mustEmbedUnimplementedAnswerServer() {}
func (UnimplementedAnswerServer) testEmbeddedByValue() {}
// UnsafeAnswerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AnswerServer will
// result in compilation errors.
type UnsafeAnswerServer interface {
mustEmbedUnimplementedAnswerServer()
}
func RegisterAnswerServer(s grpc.ServiceRegistrar, srv AnswerServer) {
// If the following call pancis, it indicates UnimplementedAnswerServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Answer_ServiceDesc, srv)
}
func _Answer_Submit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SubmitAnswerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AnswerServer).Submit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Answer_Submit_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AnswerServer).Submit(ctx, req.(*SubmitAnswerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Answer_BySurvey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AnswerServer).BySurvey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Answer_BySurvey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AnswerServer).BySurvey(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
// Answer_ServiceDesc is the grpc.ServiceDesc for Answer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Answer_ServiceDesc = grpc.ServiceDesc{
ServiceName: "survey.Answer",
HandlerType: (*AnswerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Submit",
Handler: _Answer_Submit_Handler,
},
{
MethodName: "BySurvey",
Handler: _Answer_BySurvey_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "answer.proto",
}