first commit
This commit is contained in:
38
deploy/script/gen_models.ps1
Normal file
38
deploy/script/gen_models.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
# 设置输出编码为UTF-8
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
# 数据库连接信息 - 修改了URL格式
|
||||
$DB_URL = "aedata:5vg67b3UNHu8@(127.0.0.1:21001)/aedata"
|
||||
$OUTPUT_DIR = "./model"
|
||||
$TEMPLATE_DIR = "../template"
|
||||
|
||||
# 表名列表
|
||||
$tables = @(
|
||||
"feature",
|
||||
"global_notifications"
|
||||
"order",
|
||||
"order_refund"
|
||||
"product",
|
||||
"product_feature",
|
||||
"query",
|
||||
"query_cleanup_log"
|
||||
"query_cleanup_detail"
|
||||
"query_cleanup_config"
|
||||
"user"
|
||||
"user_auth"
|
||||
"user_temp"
|
||||
"example"
|
||||
"admin_user"
|
||||
"admin_user_role"
|
||||
"admin_api",
|
||||
"admin_menu"
|
||||
"admin_role",
|
||||
"admin_role_api",
|
||||
"admin_role_menu",
|
||||
"admin_dict_data"
|
||||
"admin_dict_type"
|
||||
)
|
||||
|
||||
# 为每个表生成模型
|
||||
foreach ($table in $tables) {
|
||||
goctl model mysql datasource -url="aedata:6bV4kPqR1sXe@tcp(127.0.0.1:21001)/aedata" -table="$table" -dir="./model" --home="../template" -cache=true --style=goZero
|
||||
}
|
||||
9
deploy/script/model/vars.go
Normal file
9
deploy/script/model/vars.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
)
|
||||
|
||||
var ErrNotFound = sqlx.ErrNotFound
|
||||
var ErrNoRowsUpdate = errors.New("update db no rows change")
|
||||
Reference in New Issue
Block a user