feat 协议

This commit is contained in:
2026-01-12 00:44:26 +08:00
parent 6bc9f18199
commit 43ca340d54
9 changed files with 22 additions and 14 deletions

View File

@@ -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
View File

@@ -0,0 +1,3 @@
module git.hlsq.asia/mmorpg
go 1.23.1

View File

@@ -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 {

View File

@@ -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 {