v2.0
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
# 使用方法:
|
||||
# .\genModel.ps1 user user
|
||||
# .\genModel.ps1 user user_auth
|
||||
# 再将 .\genModel 下的文件剪切到对应服务的 model 目录里面,记得改 package
|
||||
# goctl model mysql datasource -url="qnc:5vg67b3UNHu8@tcp(127.0.0.1:20001)/qnc" -table="product" -dir="./model" --home="../template" -cache=true --style=goZero
|
||||
param (
|
||||
[string]$database,
|
||||
[string]$tables
|
||||
)
|
||||
|
||||
# 生成的表名
|
||||
$modeldir = "./genModel"
|
||||
$templateDir = Join-Path -Path (Resolve-Path "$PSScriptRoot/..") -ChildPath "template"
|
||||
# 数据库配置
|
||||
$host = "127.0.0.1"
|
||||
$port = "20001"
|
||||
$dbname = "$database"
|
||||
$username = "qnc"
|
||||
$passwd = "5vg67b3UNHu8"
|
||||
|
||||
Write-Output "开始创建库:$dbname 的表:$tables"
|
||||
|
||||
# 执行 goctl 命令生成 model
|
||||
$command = "goctl model mysql datasource -url=`"$username`:$passwd`@tcp($host`:$port)/$dbname`" -table=`"$tables`" -dir=`"$modeldir`" --home=`"$templateDir`" -cache=true --style=goZero"
|
||||
Invoke-Expression $command
|
||||
@@ -15,7 +15,7 @@ $tables = @(
|
||||
# "agent_commission_deduction",
|
||||
# "agent_link",
|
||||
# "agent_membership_config",
|
||||
# "agent_membership_recharge_order"
|
||||
"agent_membership_recharge_order"
|
||||
# "agent_membership_user_config",
|
||||
# "agent_order",
|
||||
# "agent_platform_deduction",
|
||||
@@ -31,7 +31,7 @@ $tables = @(
|
||||
# "query",
|
||||
# "user"
|
||||
# "user_auth"
|
||||
"example"
|
||||
# "example"
|
||||
)
|
||||
|
||||
# 为每个表生成模型
|
||||
|
||||
Reference in New Issue
Block a user