feat 协议
This commit is contained in:
517
proto/rs/grpc_pb/service_qgdzs.pb.go
Normal file
517
proto/rs/grpc_pb/service_qgdzs.pb.go
Normal file
@@ -0,0 +1,517 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.32.0
|
||||
// protoc v4.25.1
|
||||
// source: service_qgdzs.proto
|
||||
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
_ "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// ---------- GenerateQuestion ----------
|
||||
type GenerateQuestionReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Num int32 `protobuf:"varint,1,opt,name=Num,json=num,proto3" json:"Num,omitempty"` // 生成数量
|
||||
Category string `protobuf:"bytes,2,opt,name=Category,json=category,proto3" json:"Category,omitempty"` // 题目类型
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) Reset() {
|
||||
*x = GenerateQuestionReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GenerateQuestionReq) ProtoMessage() {}
|
||||
|
||||
func (x *GenerateQuestionReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GenerateQuestionReq.ProtoReflect.Descriptor instead.
|
||||
func (*GenerateQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) GetNum() int32 {
|
||||
if x != nil {
|
||||
return x.Num
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GenerateQuestionResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionResp) Reset() {
|
||||
*x = GenerateQuestionResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GenerateQuestionResp) ProtoMessage() {}
|
||||
|
||||
func (x *GenerateQuestionResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GenerateQuestionResp.ProtoReflect.Descriptor instead.
|
||||
func (*GenerateQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
// ---------- GetQuestion ----------
|
||||
type GetQuestionReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GetQuestionReq) Reset() {
|
||||
*x = GetQuestionReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetQuestionReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetQuestionReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetQuestionReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetQuestionReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type GetQuestionResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Question string `protobuf:"bytes,2,opt,name=Question,json=question,proto3" json:"Question,omitempty"` // 题干
|
||||
Options []string `protobuf:"bytes,3,rep,name=Options,json=options,proto3" json:"Options,omitempty"` // 选项
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) Reset() {
|
||||
*x = GetQuestionResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetQuestionResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetQuestionResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetQuestionResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) GetSn() string {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) GetQuestion() string {
|
||||
if x != nil {
|
||||
return x.Question
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) GetOptions() []string {
|
||||
if x != nil {
|
||||
return x.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------- AnswerQuestion ----------
|
||||
type AnswerQuestionReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Answer string `protobuf:"bytes,2,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) Reset() {
|
||||
*x = AnswerQuestionReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AnswerQuestionReq) ProtoMessage() {}
|
||||
|
||||
func (x *AnswerQuestionReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AnswerQuestionReq.ProtoReflect.Descriptor instead.
|
||||
func (*AnswerQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) GetSn() string {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) GetAnswer() string {
|
||||
if x != nil {
|
||||
return x.Answer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AnswerQuestionResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Answer string `protobuf:"bytes,1,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案
|
||||
Explanation string `protobuf:"bytes,2,opt,name=Explanation,json=explanation,proto3" json:"Explanation,omitempty"` // 解析
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) Reset() {
|
||||
*x = AnswerQuestionResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AnswerQuestionResp) ProtoMessage() {}
|
||||
|
||||
func (x *AnswerQuestionResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_qgdzs_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AnswerQuestionResp.ProtoReflect.Descriptor instead.
|
||||
func (*AnswerQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) GetAnswer() string {
|
||||
if x != nil {
|
||||
return x.Answer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) GetExplanation() string {
|
||||
if x != nil {
|
||||
return x.Explanation
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_service_qgdzs_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x71, 0x67, 0x64, 0x7a, 0x73, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x43, 0x0a, 0x13, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
|
||||
0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x4e,
|
||||
0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x6e,
|
||||
0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x22, 0x10, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x71, 0x22, 0x57, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20,
|
||||
0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3b, 0x0a, 0x11,
|
||||
0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x73,
|
||||
0x6e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x12, 0x41, 0x6e, 0x73,
|
||||
0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x6c, 0x61,
|
||||
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78,
|
||||
0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x9d, 0x02, 0x0a, 0x05, 0x51, 0x67,
|
||||
0x64, 0x7a, 0x73, 0x12, 0x64, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51,
|
||||
0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61,
|
||||
0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e,
|
||||
0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x01, 0x2a, 0x22,
|
||||
0x18, 0x2f, 0x71, 0x67, 0x64, 0x7a, 0x73, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
|
||||
0x5f, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, 0x0a, 0x0b, 0x47, 0x65, 0x74,
|
||||
0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75,
|
||||
0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x51,
|
||||
0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1e, 0x82, 0xd3, 0xe4,
|
||||
0x93, 0x02, 0x18, 0x3a, 0x01, 0x2a, 0x22, 0x13, 0x2f, 0x71, 0x67, 0x64, 0x7a, 0x73, 0x2f, 0x67,
|
||||
0x65, 0x74, 0x5f, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5c, 0x0a, 0x0e, 0x41,
|
||||
0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e,
|
||||
0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x1a, 0x13, 0x2e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x3a, 0x01,
|
||||
0x2a, 0x22, 0x16, 0x2f, 0x71, 0x67, 0x64, 0x7a, 0x73, 0x2f, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72,
|
||||
0x5f, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74,
|
||||
0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70,
|
||||
0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_service_qgdzs_proto_rawDescOnce sync.Once
|
||||
file_service_qgdzs_proto_rawDescData = file_service_qgdzs_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_service_qgdzs_proto_rawDescGZIP() []byte {
|
||||
file_service_qgdzs_proto_rawDescOnce.Do(func() {
|
||||
file_service_qgdzs_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_qgdzs_proto_rawDescData)
|
||||
})
|
||||
return file_service_qgdzs_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_qgdzs_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_service_qgdzs_proto_goTypes = []interface{}{
|
||||
(*GenerateQuestionReq)(nil), // 0: GenerateQuestionReq
|
||||
(*GenerateQuestionResp)(nil), // 1: GenerateQuestionResp
|
||||
(*GetQuestionReq)(nil), // 2: GetQuestionReq
|
||||
(*GetQuestionResp)(nil), // 3: GetQuestionResp
|
||||
(*AnswerQuestionReq)(nil), // 4: AnswerQuestionReq
|
||||
(*AnswerQuestionResp)(nil), // 5: AnswerQuestionResp
|
||||
}
|
||||
var file_service_qgdzs_proto_depIdxs = []int32{
|
||||
0, // 0: Qgdzs.GenerateQuestion:input_type -> GenerateQuestionReq
|
||||
2, // 1: Qgdzs.GetQuestion:input_type -> GetQuestionReq
|
||||
4, // 2: Qgdzs.AnswerQuestion:input_type -> AnswerQuestionReq
|
||||
1, // 3: Qgdzs.GenerateQuestion:output_type -> GenerateQuestionResp
|
||||
3, // 4: Qgdzs.GetQuestion:output_type -> GetQuestionResp
|
||||
5, // 5: Qgdzs.AnswerQuestion:output_type -> AnswerQuestionResp
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_qgdzs_proto_init() }
|
||||
func file_service_qgdzs_proto_init() {
|
||||
if File_service_qgdzs_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_service_qgdzs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GenerateQuestionReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_qgdzs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GenerateQuestionResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_qgdzs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetQuestionReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_qgdzs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetQuestionResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_qgdzs_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AnswerQuestionReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_qgdzs_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AnswerQuestionResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_qgdzs_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_service_qgdzs_proto_goTypes,
|
||||
DependencyIndexes: file_service_qgdzs_proto_depIdxs,
|
||||
MessageInfos: file_service_qgdzs_proto_msgTypes,
|
||||
}.Build()
|
||||
File_service_qgdzs_proto = out.File
|
||||
file_service_qgdzs_proto_rawDesc = nil
|
||||
file_service_qgdzs_proto_goTypes = nil
|
||||
file_service_qgdzs_proto_depIdxs = nil
|
||||
}
|
||||
280
proto/rs/grpc_pb/service_qgdzs.pb.gw.go
Normal file
280
proto/rs/grpc_pb/service_qgdzs.pb.gw.go
Normal file
@@ -0,0 +1,280 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: service_qgdzs.proto
|
||||
|
||||
/*
|
||||
Package grpc_pb is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var (
|
||||
_ codes.Code
|
||||
_ io.Reader
|
||||
_ status.Status
|
||||
_ = errors.New
|
||||
_ = runtime.String
|
||||
_ = utilities.NewDoubleArray
|
||||
_ = metadata.Join
|
||||
)
|
||||
|
||||
func request_Qgdzs_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GenerateQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GenerateQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GenerateQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GenerateQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GetQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq AnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.AnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq AnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.AnswerQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandlerServer registers the http handlers for service Qgdzs to "mux".
|
||||
// UnaryRPC :call QgdzsServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQgdzsHandlerFromEndpoint instead.
|
||||
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
|
||||
func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QgdzsServer) error {
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GenerateQuestion", runtime.WithHTTPPathPattern("/qgdzs/generate_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_GenerateQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetQuestion", runtime.WithHTTPPathPattern("/qgdzs/get_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_GetQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_AnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/AnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/answer_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_AnswerQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandlerFromEndpoint is same as RegisterQgdzsHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterQgdzsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.NewClient(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
return RegisterQgdzsHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandler registers the http handlers for service Qgdzs to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterQgdzsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterQgdzsHandlerClient(ctx, mux, NewQgdzsClient(conn))
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandlerClient registers the http handlers for service Qgdzs
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QgdzsClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QgdzsClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "QgdzsClient" to call the correct interceptors. This client ignores the HTTP middlewares.
|
||||
func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QgdzsClient) error {
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GenerateQuestion", runtime.WithHTTPPathPattern("/qgdzs/generate_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_GenerateQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetQuestion", runtime.WithHTTPPathPattern("/qgdzs/get_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_GetQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_AnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/AnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/answer_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_AnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Qgdzs_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"qgdzs", "generate_question"}, ""))
|
||||
pattern_Qgdzs_GetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"qgdzs", "get_question"}, ""))
|
||||
pattern_Qgdzs_AnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"qgdzs", "answer_question"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Qgdzs_GenerateQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_GetQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_AnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
183
proto/rs/grpc_pb/service_qgdzs_grpc.pb.go
Normal file
183
proto/rs/grpc_pb/service_qgdzs_grpc.pb.go
Normal file
@@ -0,0 +1,183 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v4.25.1
|
||||
// source: service_qgdzs.proto
|
||||
|
||||
package grpc_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
|
||||
|
||||
// QgdzsClient is the client API for Qgdzs 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 QgdzsClient interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
|
||||
// 获取题目
|
||||
GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error)
|
||||
// 回答题目
|
||||
AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error)
|
||||
}
|
||||
|
||||
type qgdzsClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewQgdzsClient(cc grpc.ClientConnInterface) QgdzsClient {
|
||||
return &qgdzsClient{cc}
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error) {
|
||||
out := new(GenerateQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/GenerateQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error) {
|
||||
out := new(GetQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/GetQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error) {
|
||||
out := new(AnswerQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/AnswerQuestion", 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
|
||||
type QgdzsServer interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
|
||||
// 获取题目
|
||||
GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error)
|
||||
// 回答题目
|
||||
AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error)
|
||||
mustEmbedUnimplementedQgdzsServer()
|
||||
}
|
||||
|
||||
// UnimplementedQgdzsServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedQgdzsServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedQgdzsServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AnswerQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) mustEmbedUnimplementedQgdzsServer() {}
|
||||
|
||||
// UnsafeQgdzsServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to QgdzsServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeQgdzsServer interface {
|
||||
mustEmbedUnimplementedQgdzsServer()
|
||||
}
|
||||
|
||||
func RegisterQgdzsServer(s grpc.ServiceRegistrar, srv QgdzsServer) {
|
||||
s.RegisterService(&Qgdzs_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Qgdzs_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GenerateQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).GenerateQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/GenerateQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).GenerateQuestion(ctx, req.(*GenerateQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_GetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).GetQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/GetQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).GetQuestion(ctx, req.(*GetQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_AnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AnswerQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).AnswerQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/AnswerQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).AnswerQuestion(ctx, req.(*AnswerQuestionReq))
|
||||
}
|
||||
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)
|
||||
var Qgdzs_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "Qgdzs",
|
||||
HandlerType: (*QgdzsServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GenerateQuestion",
|
||||
Handler: _Qgdzs_GenerateQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetQuestion",
|
||||
Handler: _Qgdzs_GetQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AnswerQuestion",
|
||||
Handler: _Qgdzs_AnswerQuestion_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_qgdzs.proto",
|
||||
}
|
||||
@@ -236,313 +236,6 @@ func (x *GetUserInfoResp) GetName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// ---------- GenerateQuestion ----------
|
||||
type GenerateQuestionReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Num int32 `protobuf:"varint,1,opt,name=Num,json=num,proto3" json:"Num,omitempty"` // 生成数量
|
||||
Category string `protobuf:"bytes,2,opt,name=Category,json=category,proto3" json:"Category,omitempty"` // 题目类型
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) Reset() {
|
||||
*x = GenerateQuestionReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GenerateQuestionReq) ProtoMessage() {}
|
||||
|
||||
func (x *GenerateQuestionReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GenerateQuestionReq.ProtoReflect.Descriptor instead.
|
||||
func (*GenerateQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) GetNum() int32 {
|
||||
if x != nil {
|
||||
return x.Num
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionReq) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GenerateQuestionResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionResp) Reset() {
|
||||
*x = GenerateQuestionResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GenerateQuestionResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GenerateQuestionResp) ProtoMessage() {}
|
||||
|
||||
func (x *GenerateQuestionResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GenerateQuestionResp.ProtoReflect.Descriptor instead.
|
||||
func (*GenerateQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
// ---------- GetQuestion ----------
|
||||
type GetQuestionReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GetQuestionReq) Reset() {
|
||||
*x = GetQuestionReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetQuestionReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetQuestionReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetQuestionReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetQuestionReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
type GetQuestionResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Question string `protobuf:"bytes,2,opt,name=Question,json=question,proto3" json:"Question,omitempty"` // 题干
|
||||
Options []string `protobuf:"bytes,3,rep,name=Options,json=options,proto3" json:"Options,omitempty"` // 选项
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) Reset() {
|
||||
*x = GetQuestionResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetQuestionResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetQuestionResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetQuestionResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) GetSn() string {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) GetQuestion() string {
|
||||
if x != nil {
|
||||
return x.Question
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetQuestionResp) GetOptions() []string {
|
||||
if x != nil {
|
||||
return x.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---------- AnswerQuestion ----------
|
||||
type AnswerQuestionReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Answer string `protobuf:"bytes,2,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) Reset() {
|
||||
*x = AnswerQuestionReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AnswerQuestionReq) ProtoMessage() {}
|
||||
|
||||
func (x *AnswerQuestionReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AnswerQuestionReq.ProtoReflect.Descriptor instead.
|
||||
func (*AnswerQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) GetSn() string {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionReq) GetAnswer() string {
|
||||
if x != nil {
|
||||
return x.Answer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AnswerQuestionResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Answer string `protobuf:"bytes,1,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案
|
||||
Explanation string `protobuf:"bytes,2,opt,name=Explanation,json=explanation,proto3" json:"Explanation,omitempty"` // 解析
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) Reset() {
|
||||
*x = AnswerQuestionResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AnswerQuestionResp) ProtoMessage() {}
|
||||
|
||||
func (x *AnswerQuestionResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[9]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AnswerQuestionResp.ProtoReflect.Descriptor instead.
|
||||
func (*AnswerQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) GetAnswer() string {
|
||||
if x != nil {
|
||||
return x.Answer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AnswerQuestionResp) GetExplanation() string {
|
||||
if x != nil {
|
||||
return x.Explanation
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_service_user_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_user_proto_rawDesc = []byte{
|
||||
@@ -562,57 +255,18 @@ var file_service_user_proto_rawDesc = []byte{
|
||||
0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52,
|
||||
0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x13, 0x47, 0x65, 0x6e,
|
||||
0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e,
|
||||
0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x16,
|
||||
0x0a, 0x14, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x10, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65,
|
||||
0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x57, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x51,
|
||||
0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x53,
|
||||
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x51,
|
||||
0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x22, 0x3b, 0x0a, 0x11, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x4e,
|
||||
0x0a, 0x12, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b,
|
||||
0x45, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x84,
|
||||
0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
|
||||
0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f,
|
||||
0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74,
|
||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73,
|
||||
0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55,
|
||||
0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4,
|
||||
0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x63, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75,
|
||||
0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
|
||||
0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x47,
|
||||
0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
||||
0x65, 0x73, 0x70, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x3a, 0x01, 0x2a, 0x22, 0x17,
|
||||
0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4f, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x51, 0x75,
|
||||
0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65,
|
||||
0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||
0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x74, 0x5f,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5b, 0x0a, 0x0e, 0x41, 0x6e, 0x73, 0x77,
|
||||
0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e, 0x41, 0x6e, 0x73,
|
||||
0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x13,
|
||||
0x2e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
||||
0x65, 0x73, 0x70, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15,
|
||||
0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x5f, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73,
|
||||
0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x71, 0x0a, 0x04, 0x55, 0x73, 0x65,
|
||||
0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a,
|
||||
0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x36, 0x5a, 0x34,
|
||||
0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d,
|
||||
0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70,
|
||||
0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -627,32 +281,20 @@ func file_service_user_proto_rawDescGZIP() []byte {
|
||||
return file_service_user_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_service_user_proto_goTypes = []interface{}{
|
||||
(*LoginReq)(nil), // 0: LoginReq
|
||||
(*LoginResp)(nil), // 1: LoginResp
|
||||
(*GetUserInfoReq)(nil), // 2: GetUserInfoReq
|
||||
(*GetUserInfoResp)(nil), // 3: GetUserInfoResp
|
||||
(*GenerateQuestionReq)(nil), // 4: GenerateQuestionReq
|
||||
(*GenerateQuestionResp)(nil), // 5: GenerateQuestionResp
|
||||
(*GetQuestionReq)(nil), // 6: GetQuestionReq
|
||||
(*GetQuestionResp)(nil), // 7: GetQuestionResp
|
||||
(*AnswerQuestionReq)(nil), // 8: AnswerQuestionReq
|
||||
(*AnswerQuestionResp)(nil), // 9: AnswerQuestionResp
|
||||
(*LoginReq)(nil), // 0: LoginReq
|
||||
(*LoginResp)(nil), // 1: LoginResp
|
||||
(*GetUserInfoReq)(nil), // 2: GetUserInfoReq
|
||||
(*GetUserInfoResp)(nil), // 3: GetUserInfoResp
|
||||
}
|
||||
var file_service_user_proto_depIdxs = []int32{
|
||||
0, // 0: User.Login:input_type -> LoginReq
|
||||
2, // 1: User.GetUserInfo:input_type -> GetUserInfoReq
|
||||
4, // 2: User.GenerateQuestion:input_type -> GenerateQuestionReq
|
||||
6, // 3: User.GetQuestion:input_type -> GetQuestionReq
|
||||
8, // 4: User.AnswerQuestion:input_type -> AnswerQuestionReq
|
||||
1, // 5: User.Login:output_type -> LoginResp
|
||||
3, // 6: User.GetUserInfo:output_type -> GetUserInfoResp
|
||||
5, // 7: User.GenerateQuestion:output_type -> GenerateQuestionResp
|
||||
7, // 8: User.GetQuestion:output_type -> GetQuestionResp
|
||||
9, // 9: User.AnswerQuestion:output_type -> AnswerQuestionResp
|
||||
5, // [5:10] is the sub-list for method output_type
|
||||
0, // [0:5] is the sub-list for method input_type
|
||||
1, // 2: User.Login:output_type -> LoginResp
|
||||
3, // 3: User.GetUserInfo:output_type -> GetUserInfoResp
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
@@ -712,78 +354,6 @@ func file_service_user_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GenerateQuestionReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GenerateQuestionResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetQuestionReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetQuestionResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AnswerQuestionReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AnswerQuestionResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@@ -791,7 +361,7 @@ func file_service_user_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_user_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -59,78 +59,6 @@ func local_request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Mar
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_User_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GenerateQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GenerateQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_User_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GenerateQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GenerateQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_User_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_User_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GetQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_User_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq AnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.AnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_User_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq AnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.AnswerQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
// RegisterUserHandlerServer registers the http handlers for service User to "mux".
|
||||
// UnaryRPC :call UserServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
@@ -157,66 +85,6 @@ func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
|
||||
}
|
||||
forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_User_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GenerateQuestion", runtime.WithHTTPPathPattern("/user/generate_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_User_GenerateQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_User_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_User_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GetQuestion", runtime.WithHTTPPathPattern("/user/get_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_User_GetQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_User_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_User_AnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/AnswerQuestion", runtime.WithHTTPPathPattern("/user/answer_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_User_AnswerQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_User_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -274,70 +142,13 @@ func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
|
||||
}
|
||||
forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_User_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GenerateQuestion", runtime.WithHTTPPathPattern("/user/generate_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_User_GenerateQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_User_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_User_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GetQuestion", runtime.WithHTTPPathPattern("/user/get_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_User_GetQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_User_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_User_AnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/AnswerQuestion", runtime.WithHTTPPathPattern("/user/answer_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_User_AnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_User_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, ""))
|
||||
pattern_User_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "generate_question"}, ""))
|
||||
pattern_User_GetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "get_question"}, ""))
|
||||
pattern_User_AnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "answer_question"}, ""))
|
||||
pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_User_GetUserInfo_0 = runtime.ForwardResponseMessage
|
||||
forward_User_GenerateQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_User_GetQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_User_AnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_User_GetUserInfo_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
||||
@@ -25,12 +25,6 @@ type UserClient interface {
|
||||
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error)
|
||||
// 获取用户信息
|
||||
GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error)
|
||||
// 生成题目
|
||||
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
|
||||
// 获取题目
|
||||
GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error)
|
||||
// 回答题目
|
||||
AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error)
|
||||
}
|
||||
|
||||
type userClient struct {
|
||||
@@ -59,33 +53,6 @@ func (c *userClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts .
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userClient) GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error) {
|
||||
out := new(GenerateQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/User/GenerateQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userClient) GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error) {
|
||||
out := new(GetQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/User/GetQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userClient) AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error) {
|
||||
out := new(AnswerQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/User/AnswerQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// UserServer is the server API for User service.
|
||||
// All implementations must embed UnimplementedUserServer
|
||||
// for forward compatibility
|
||||
@@ -93,12 +60,6 @@ type UserServer interface {
|
||||
Login(context.Context, *LoginReq) (*LoginResp, error)
|
||||
// 获取用户信息
|
||||
GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error)
|
||||
// 生成题目
|
||||
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
|
||||
// 获取题目
|
||||
GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error)
|
||||
// 回答题目
|
||||
AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error)
|
||||
mustEmbedUnimplementedUserServer()
|
||||
}
|
||||
|
||||
@@ -112,15 +73,6 @@ func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*LoginResp, er
|
||||
func (UnimplementedUserServer) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AnswerQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {}
|
||||
|
||||
// UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -170,60 +122,6 @@ func _User_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _User_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GenerateQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServer).GenerateQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/User/GenerateQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServer).GenerateQuestion(ctx, req.(*GenerateQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _User_GetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServer).GetQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/User/GetQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServer).GetQuestion(ctx, req.(*GetQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _User_AnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AnswerQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServer).AnswerQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/User/AnswerQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServer).AnswerQuestion(ctx, req.(*AnswerQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// User_ServiceDesc is the grpc.ServiceDesc for User service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -239,18 +137,6 @@ var User_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GetUserInfo",
|
||||
Handler: _User_GetUserInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GenerateQuestion",
|
||||
Handler: _User_GenerateQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetQuestion",
|
||||
Handler: _User_GetQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AnswerQuestion",
|
||||
Handler: _User_AnswerQuestion_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_user.proto",
|
||||
|
||||
Reference in New Issue
Block a user