feat 协议
This commit is contained in:
@@ -5,10 +5,8 @@ if not exist "./gen" (
|
||||
)
|
||||
|
||||
protoc --proto_path=./sources --go_out=./gen ./sources/*.proto
|
||||
@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q
|
||||
|
||||
if not exist "./gen/client" (
|
||||
mkdir "./gen/client"
|
||||
)
|
||||
protoc --proto_path=./sources --csharp_out=./gen/client ./sources/*.proto
|
||||
@REM xcopy "./gen/client" "../../../Client/Point/Assets/Scripts/Proto" /E /I /Y /Q
|
||||
protoc --proto_path=./sources --csharp_out=./gen/client ./sources/*.proto
|
||||
@@ -242,8 +242,8 @@ type GenerateQuestionReq struct {
|
||||
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,proto3" json:"Category,omitempty"` // 题目类型
|
||||
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() {
|
||||
@@ -566,7 +566,7 @@ var file_service_user_proto_rawDesc = []byte{
|
||||
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, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x16,
|
||||
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,
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
"format": "int32",
|
||||
"title": "生成数量"
|
||||
},
|
||||
"Category": {
|
||||
"category": {
|
||||
"type": "string",
|
||||
"title": "题目类型"
|
||||
}
|
||||
|
||||
@@ -10,5 +10,4 @@ protoc ^
|
||||
--go-grpc_out=./gen ^
|
||||
--grpc-gateway_out=./gen ^
|
||||
--openapiv2_out=./gen ^
|
||||
./sources/*.proto
|
||||
@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q
|
||||
./sources/*.proto
|
||||
@@ -54,7 +54,7 @@ message GetUserInfoResp {
|
||||
// ---------- GenerateQuestion ----------
|
||||
message GenerateQuestionReq {
|
||||
int32 Num = 1 [json_name = "num"]; // 生成数量
|
||||
string Category = 2 [json_name = "Category"]; // 题目类型
|
||||
string Category = 2 [json_name = "category"]; // 题目类型
|
||||
}
|
||||
message GenerateQuestionResp {
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# gen.ps1 - 极简版
|
||||
# gen.ps1 - 支持参数版
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$dbName
|
||||
)
|
||||
& .\gentool.exe `
|
||||
-dsn "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local" `
|
||||
-dsn "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/${dbName}?charset=utf8mb4&parseTime=True&loc=Local" `
|
||||
-fieldSignable `
|
||||
-outPath "./user_db/query"
|
||||
-outPath "./${dbName}/query"
|
||||
|
||||
Get-ChildItem ./user_db/model/*.gen.go | ForEach-Object {
|
||||
Get-ChildItem ./${dbName}/model/*.gen.go | ForEach-Object {
|
||||
$c = Get-Content $_.FullName -Raw -Encoding UTF8
|
||||
if ($c -match '\bSn\s+string\b' -and $c -notmatch 'BeforeCreate') {
|
||||
$c -match 'type\s+(\w+)\s+struct' | Out-Null
|
||||
|
||||
3
Tools/mysql_model/go.mod
Normal file
3
Tools/mysql_model/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module git.hlsq.asia/mmorpg
|
||||
|
||||
go 1.23.1
|
||||
@@ -15,6 +15,8 @@ import (
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/user_db/model"
|
||||
)
|
||||
|
||||
func newQuestion(db *gorm.DB, opts ...gen.DOOption) question {
|
||||
|
||||
@@ -15,6 +15,8 @@ import (
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/user_db/model"
|
||||
)
|
||||
|
||||
func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
||||
|
||||
Reference in New Issue
Block a user