feat 协议
This commit is contained in:
@@ -30,6 +30,8 @@ type QgdzsClient interface {
|
||||
AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error)
|
||||
// 获取所有类目
|
||||
GetAllCategory(ctx context.Context, in *GetAllCategoryReq, opts ...grpc.CallOption) (*GetAllCategoryResp, error)
|
||||
// 获取答题记录
|
||||
GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error)
|
||||
}
|
||||
|
||||
type qgdzsClient struct {
|
||||
@@ -76,6 +78,15 @@ func (c *qgdzsClient) GetAllCategory(ctx context.Context, in *GetAllCategoryReq,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error) {
|
||||
out := new(GetRecordResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/GetRecord", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QgdzsServer is the server API for Qgdzs service.
|
||||
// All implementations must embed UnimplementedQgdzsServer
|
||||
// for forward compatibility
|
||||
@@ -88,6 +99,8 @@ type QgdzsServer interface {
|
||||
AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error)
|
||||
// 获取所有类目
|
||||
GetAllCategory(context.Context, *GetAllCategoryReq) (*GetAllCategoryResp, error)
|
||||
// 获取答题记录
|
||||
GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error)
|
||||
mustEmbedUnimplementedQgdzsServer()
|
||||
}
|
||||
|
||||
@@ -107,6 +120,9 @@ func (UnimplementedQgdzsServer) AnswerQuestion(context.Context, *AnswerQuestionR
|
||||
func (UnimplementedQgdzsServer) GetAllCategory(context.Context, *GetAllCategoryReq) (*GetAllCategoryResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAllCategory not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRecord not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) mustEmbedUnimplementedQgdzsServer() {}
|
||||
|
||||
// UnsafeQgdzsServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -192,6 +208,24 @@ func _Qgdzs_GetAllCategory_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_GetRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRecordReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).GetRecord(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/GetRecord",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).GetRecord(ctx, req.(*GetRecordReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Qgdzs_ServiceDesc is the grpc.ServiceDesc for Qgdzs service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -215,6 +249,10 @@ var Qgdzs_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GetAllCategory",
|
||||
Handler: _Qgdzs_GetAllCategory_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRecord",
|
||||
Handler: _Qgdzs_GetRecord_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_qgdzs.proto",
|
||||
|
||||
Reference in New Issue
Block a user