feat 协议
This commit is contained in:
@@ -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