23 Commits

Author SHA1 Message Date
mengshuai
b58643cc2f fix 修复生成代码 pgsql 菜单权限生成和个别数据类型生成错误,vue 方法导入改为自动导入 2025-11-09 13:49:11 +08:00
孟帅
a7234bc330 feat 调整 mysql 、pgsql 初始化数据; 完善pgsql 兼容性,适配代码生成逻辑 2025-11-08 12:40:03 +08:00
孟帅
3989996448 Merge pull request #211 from 0x76long/0x76long-patch-1
修复因大小写导致找不到表主键的问题
2025-11-07 12:44:11 +08:00
vlong
c94184a385 修复因大小写导致找不到表主键的问题 2025-11-07 11:41:13 +08:00
孟帅
7313d22cdb 发布v2.18.6版本,更新内容请查看:https://github.com/bufanyun/hotgo/blob/v2.0/docs/guide-zh-CN/start-update-log.md 2025-10-25 00:35:30 +08:00
孟帅
5ebc33f28b Merge pull request #205 from youluo1230/v2.0
fix(admin):修复消息查询
2025-10-21 22:45:51 +08:00
小宝
70076c90fd fix(admin):修复消息查询 2025-10-21 15:04:58 +08:00
孟帅
e8c94f1c98 Merge pull request #204 from yemangran/v2.0
修复新增按钮类型的菜单到hg_admin_menu时,component空串被清空导致新增失败
2025-10-15 22:40:14 +08:00
孟帅
5fa7b471f5 Merge pull request #203 from yemangran/yemangran-patch
修复字典管理页面新增时表单检验
2025-10-15 22:39:40 +08:00
孟帅
4b0f5066b7 Merge pull request #199 from osindex/develop
🎨 去除mysql硬编码 方便切换pgsql
2025-10-15 22:32:14 +08:00
孟帅
36ddd091c8 Merge pull request #198 from zhangshican/v2.0
bug修复
2025-10-15 22:31:42 +08:00
孟帅
f85d21a124 Merge pull request #197 from wangle201210/feat/yaml
添加yaml字段类型
2025-10-15 22:29:37 +08:00
孟帅
0f6f74214a Merge pull request #196 from wangle201210/fix/model
fix model.ts
2025-10-15 22:28:31 +08:00
yemangran
334f9a7888 Merge pull request #1 from yemangran/yemangran-patch-1
Update menu.go
2025-10-15 01:31:43 +08:00
yemangran
58213e83db Update menu.go
修复新增按钮类型的菜单到hg_admin_menu时,component空串被清空导致新增失败
2025-10-15 01:31:02 +08:00
yemangran
f2454ce09b Update CreateDrawer.vue 2025-10-08 13:53:55 +08:00
yemangran
31f8102cc1 Update CreateDrawer.vue 2025-10-08 13:49:12 +08:00
osi
edb673ee34 🎨 去除mysql硬编码 方便切换pgsql 2025-09-19 19:40:00 +08:00
ss
776307e65b bug修复
本地 64 位 int → 安全;线上 32 位 int → 溢出 → panic
exception recovered: runtime error: index out of range [-2]
2025-09-12 00:17:08 +08:00
wanna
a98a25ea12 添加yaml字段类型 2025-09-11 13:37:57 +08:00
wanna
e3eb4bd728 fix model.ts 2025-09-11 00:16:33 +08:00
孟帅
1688aaf371 Merge pull request #192 from entheosl/feature/entheosl-change
修复模版生成model.ts表字段如果有默认值不带引号的问题
2025-09-01 10:47:44 +08:00
lzl
ae540c6bfe 修复模版生成model.ts默认值不带引号 2025-08-18 14:35:59 +08:00
229 changed files with 9153 additions and 6764 deletions

View File

@@ -6,13 +6,13 @@
</p>
<p align="center">
<a href="https://goframe.org/pages/viewpage.action?pageId=1114119" target="_blank">
<img src="https://img.shields.io/badge/goframe-2.9.0-green" alt="goframe">
<img src="https://img.shields.io/badge/goframe-2.9.4-green" alt="goframe">
</a>
<a href="https://v3.vuejs.org/" target="_blank">
<img src="https://img.shields.io/badge/vue.js-vue3.4-green" alt="vue">
</a>
<a href="https://www.naiveui.com" target="_blank">
<img src="https://img.shields.io/badge/naiveui-%3E2.42.0-blue" alt="naiveui">
<img src="https://img.shields.io/badge/naiveui-%3E2.43.1-blue" alt="naiveui">
</a>
<a href="https://www.tslang.cn/" target="_blank">
<img src="https://img.shields.io/badge/typescript-%3E4.0.0-blue" alt="typescript">
@@ -136,7 +136,7 @@
* 本项目包含的第三方源码和二进制文件之版权信息另行标注。
* 版权所有Copyright © 2020-2025 by Ms (https://github.com/bufanyun/hotgo)
* 版权所有Copyright © 2020-2026 by Ms (https://github.com/bufanyun/hotgo)
* All rights reserved。
@@ -158,7 +158,7 @@
## License
[MIT © HotGo-2025](./LICENSE)
[MIT © HotGo-2026](./LICENSE)

View File

@@ -27,6 +27,7 @@
- [WebSocket服务器](sys-websocket-server.md)
- [TCP服务器](sys-tcp-server.md)
- [SaaS多租户](sys-tenant.md)
- [国际化](sys-i18n.md)
- [单元测试](sys-test.md)

View File

@@ -92,6 +92,7 @@ gfcli:
gen:
dao:
- link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true"
# - link: "pgsql:postgres:hg123456@tcp(127.0.0.1:5432)/hotgo"
group: "default" # 分组 使用hotgo代码生成功能时必须填
# tables: "" # 指定当前数据库中需要执行代码生成的数据表。如果为空,表示数据库的所有表都会生成。
tablesEx: "hg_sys_addons_install" # 指定当前数据库中需要排除代码生成的数据表。
@@ -147,6 +148,7 @@ database:
stdout: true
default:
link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true"
# link: "pgsql:postgres:hg123456@tcp(127.0.0.1:5432)/hotgo"
debug: true
Prefix: "hg_"
default2:

View File

@@ -32,7 +32,7 @@
### 指定数据库驱动
> HotGo默认使用mysql驱动如果你想用其他数据库驱动打开下方文件中注释即可
> HotGo默认使用mysql驱动如果你想用其他数据库驱动打开下方文件中注释即可目前已支持mysql、pgsql
- 修改文件路径:[server/internal/library/hggen/internal/cmd/cmd_gen_dao.go](../../server/internal/library/hggen/internal/cmd/cmd_gen_dao.go)
@@ -44,7 +44,7 @@ import (
//_ "github.com/gogf/gf/contrib/drivers/mssql/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
//_ "github.com/gogf/gf/contrib/drivers/oracle/v2"
//_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
//_ "github.com/gogf/gf/contrib/drivers/sqlite/v2"
"hotgo/internal/library/hggen/internal/cmd/gendao"

View File

@@ -27,5 +27,5 @@
- node版本 >= 20.0.0
- golang版本 >= 1.23
- mysql版本 >= 5.7,引擎需要是 innoDB
- mysql版本 >= 5.7,引擎需要是 innoDB 或 postgresql版本 >=14
- IDE推荐Goland

View File

@@ -9,8 +9,8 @@
- node版本 >= v20.0.0
- golang版本 >= v1.23
- goframe版本 >=v2.7.0
- mysql版本 >=5.7
- goframe版本 >=v2.9.4
- mysql版本 >=5.7 或 postgresql版本 >=14
> 必须先看[环境搭建文档](start-environment.md),如果安装遇到问题务必先查看[常见问题文档](start-issue.md)

View File

@@ -12,6 +12,19 @@
> 如果升级(覆盖)代码后打开会出现 sql 报错, 请检查更新的数据库格式或自行调整
### v2.18.6
updated 2025.10.25
- 新增国际化i18n支持内置简体中文、繁体中文、英文三种语言包
- 新增:附件管理支持外链图片转存至系统存储驱动
- 优化:全局微信公众号实例初始化逻辑,`AccessToken` 获取方式调整为稳定版接口
- 优化:菜单权限搜索功能,支持按菜单名称或路由地址进行检索
- 优化:角色权限管理中的菜单权限分配交互体验
- 优化naive-ui版本升级到2.43.1
- 优化gf版本升级到v2.9.4
- 修复:删除角色导致关联用户无法登录的问题,新增角色删除前置校验(检查是否存在关联用户)
### v2.17.8
updated 2025.7.13

View File

@@ -108,6 +108,7 @@ gfcli:
gen:
dao:
- link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true"
# - link: "pgsql:postgres:hg123456@tcp(127.0.0.1:5432)/hotgo"
group: "default" # 分组 使用hotgo代码生成功能时必须填
# tables: "" # 指定当前数据库中需要执行代码生成的数据表。如果为空,表示数据库的所有表都会生成。
tablesEx: "hg_sys_addons_install" # 指定当前数据库中需要排除代码生成的数据表。
@@ -267,6 +268,7 @@ INSERT INTO `hg_test_table` (`id`, `category_id`, `title`, `description`, `conte
gen:
dao:
- link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true"
# - link: "pgsql:postgres:hg123456@tcp(127.0.0.1:5432)/hotgo"
group: "default" # 分组 使用hotgo代码生成功能时必须填
tablesEx: "hg_sys_addons_install" # 指定当前数据库中需要排除代码生成的数据表。
removePrefix: "hg_"
@@ -296,6 +298,7 @@ database:
stdout: true
default:
link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true"
# - link: "pgsql:postgres:hg123456@tcp(127.0.0.1:5432)/hotgo"
debug: true
Prefix: "hg_"
default2:
@@ -350,7 +353,7 @@ hggen:
### 指定数据库驱动
> HotGo默认使用mysql驱动如果你想用其他数据库驱动打开下方文件中注释即可
> HotGo默认使用mysql驱动如果你想用其他数据库驱动打开下方文件中注释即可目前已支持mysql、pgsql
修改文件路径server/internal/library/hggen/internal/cmd/cmd_gen_dao.go
```go
@@ -361,7 +364,7 @@ import (
//_ "github.com/gogf/gf/contrib/drivers/mssql/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
//_ "github.com/gogf/gf/contrib/drivers/oracle/v2"
//_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
//_ "github.com/gogf/gf/contrib/drivers/sqlite/v2"
"hotgo/internal/library/hggen/internal/cmd/gendao"

View File

@@ -0,0 +1,73 @@
## 国际化
目录
- 介绍
- 配置文件
- 服务端使用
- Web端使用
- 更多文档
### 介绍
`v2.18.6`版本开始HotGo 提供了完善的国际化i18n支持内置简体中文、繁体中文和英文三种语言包默认语言为简体中文。目前已对后台管理首页进行了多语言适配开发者可基于该机制扩展实现业务模块的多语言功能。
### 配置文件
国际化配置位于 `server/manifest/config/config.yaml` 文件中:
```yaml
# hotgo系统配置
system:
# ...
# 国际化
i18n:
switch: true # 国际化功能开关可选值false|true默认true
defaultLanguage: "zh-CN" # 默认语言可选值zh-CN|zh-TW|en默认zh-CN
```
### 服务端使用
多语言配置文件存放目录:`server/manifest/i18n`,您可以在该目录下添加自定义的语言映射文件。
**使用示例:**
```go
// 设置当前上下文的语言为英文
ctx := gctx.New()
gi18n.WithLanguage(ctx, "en")
// 基础翻译
gi18n.T(ctx, "你好,美丽世界")
// 输出Hello, Beautiful World
// 格式化翻译(支持参数替换)
gi18n.Tf(ctx, "剩余%v余额", 100)
// 输出Remaining 100 Balance
```
### Web端使用
多语言配置文件存放目录:`web/src/locale`,您可以在该目录下添加自定义的语言映射文件。
> 提示:启用国际化功能后,后台管理界面右上角将显示语言切换选项。
**使用示例(假设当前语言为英文):**
```vue
<!-- 基础翻译 -->
<div>{{ t('你好,美丽世界') }}</div>
<!-- 输出Hello, Beautiful World -->
<!-- 格式化翻译支持参数替换 -->
<div>{{ t('剩余{num}余额', {num:100}) }}</div>
<!-- 输出Remaining 100 Balance -->
```
### 更多文档
- [gi18n](https://goframe.org/docs/core/gi18n)
- [vie-i18n](https://vue-i18n.intlify.dev)

View File

@@ -87,7 +87,7 @@ func (s *sSysTable) List(ctx context.Context, in *sysin.TableListInp) (list []*s
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Hobby, in.Hobby))
}
totalCount, err = mod.Clone().Count(1)
totalCount, err = mod.Clone().Count()
if err != nil {
err = gerror.Wrap(err, "获取表格数据行失败,请稍后重试!")
return

View File

@@ -87,7 +87,7 @@ func (s *sSysTreeTable) List(ctx context.Context, in *sysin.TreeTableListInp) (l
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Hobby, in.Hobby))
}
totalCount, err = mod.Clone().Count(1)
totalCount, err = mod.Clone().Count()
if err != nil {
err = gerror.Wrap(err, "获取表格数据行失败,请稍后重试!")
return

View File

@@ -77,6 +77,9 @@ type SiteLoginConfigReq struct {
type SiteLoginConfigRes struct {
*model.LoginConfig
I18nSwitch bool `json:"i18nSwitch" dc:"国际化开关"`
DefaultLanguage string `json:"defaultLanguage" dc:"默认语言设置"`
ProjectName string `json:"projectName" dc:"项目名称"`
}
// SitePingReq ping

View File

@@ -36,3 +36,13 @@ type UploadPartReq struct {
type UploadPartRes struct {
*sysin.UploadPartModel
}
// ImageTransferStorageReq 图片链接转存
type ImageTransferStorageReq struct {
g.Meta `path:"/upload/imageTransferStorage" tags:"附件" method:"post" summary:"图片链接转存"`
sysin.ImageTransferStorageInp
}
type ImageTransferStorageRes struct {
*sysin.ImageTransferStorageModel
}

View File

@@ -1,9 +1,9 @@
// Package curddemo
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
// @AutoGenerate Version 2.18.6
package curddemo
import (
@@ -82,4 +82,4 @@ type SwitchReq struct {
sysin.CurdDemoSwitchInp
}
type SwitchRes struct{}
type SwitchRes struct{}

View File

@@ -1,9 +1,9 @@
// Package optiontreedemo
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
// @AutoGenerate Version 2.17.8
package optiontreedemo
import (
@@ -66,4 +66,4 @@ type TreeOptionReq struct {
g.Meta `path:"/optionTreeDemo/treeOption" method:"get" tags:"选项树表" summary:"获取选项树表关系树选项"`
}
type TreeOptionRes []tree.Node
type TreeOptionRes []tree.Node

View File

@@ -14,17 +14,19 @@ require (
github.com/forgoer/openssl v1.6.1
github.com/go-pay/crypto v0.0.1
github.com/go-pay/gopay v1.5.114
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0
github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0
github.com/go-pay/smap v0.0.2
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.4
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.5-0.20251017101031-c02148cd6b8b
github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.4
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.7.4
github.com/gogf/gf/v2 v2.9.1-0.20250624075347-5fa656d1cc92
github.com/gogf/gf/v2 v2.9.4
github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f
github.com/golang-jwt/jwt/v5 v5.2.2
github.com/gorilla/websocket v1.5.3
github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794
github.com/minio/minio-go/v7 v7.0.94
github.com/mojocn/base64Captcha v1.3.8
github.com/olekukonko/tablewriter v0.0.5
github.com/olekukonko/tablewriter v1.1.0
github.com/qiniu/go-sdk/v7 v7.25.4
github.com/schollz/progressbar/v3 v3.18.0
github.com/shirou/gopsutil/v3 v3.24.5
@@ -34,16 +36,16 @@ require (
github.com/tencentyun/cos-go-sdk-v5 v0.7.66
github.com/ufilesdk-dev/ufile-gosdk v1.0.6
github.com/xuri/excelize/v2 v2.9.1
go.opentelemetry.io/otel v1.37.0
golang.org/x/mod v0.25.0
golang.org/x/net v0.41.0
golang.org/x/tools v0.34.0
go.opentelemetry.io/otel v1.38.0
golang.org/x/mod v0.26.0
golang.org/x/net v0.43.0
golang.org/x/tools v0.35.0
gopkg.in/yaml.v3 v3.0.1
)
require (
aead.dev/minisign v0.2.0 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/BurntSushi/toml v1.5.0 // indirect
github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect
github.com/alibabacloud-go/debug v1.0.1 // indirect
@@ -66,14 +68,13 @@ require (
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/gammazero/toposort v0.1.1 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-pay/errgroup v0.0.3 // indirect
github.com/go-pay/smap v0.0.2 // indirect
github.com/go-pay/util v0.0.4 // indirect
github.com/go-pay/xlog v0.0.3 // indirect
github.com/go-pay/xtime v0.0.2 // indirect
@@ -99,9 +100,10 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/minio/crc64nvme v1.0.1 // indirect
@@ -111,15 +113,15 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mozillazg/go-httpheader v0.2.1 // indirect
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 // indirect
github.com/olekukonko/ll v0.0.8 // indirect
github.com/olekukonko/errors v1.1.0 // indirect
github.com/olekukonko/ll v0.0.9 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/redis/go-redis/v9 v9.7.0 // indirect
github.com/redis/go-redis/v9 v9.12.1 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
@@ -140,17 +142,17 @@ require (
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.14.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.uber.org/atomic v1.5.1 // indirect
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/image v0.25.0 // indirect
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/time v0.12.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect

View File

@@ -4,8 +4,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/IBM/sarama v1.45.2 h1:8m8LcMCu3REcwpa7fCP6v2fuPuzVwXDAM2DOv3CBrKw=
github.com/IBM/sarama v1.45.2/go.mod h1:ppaoTcVdGv186/z6MEKsMm70A5fwJfRTpstI37kVn3Y=
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
@@ -131,8 +131,8 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/gammazero/toposort v0.1.1 h1:OivGxsWxF3U3+U80VoLJ+f50HcPU1MIqE1JlKzoJ2Eg=
github.com/gammazero/toposort v0.1.1/go.mod h1:H2cozTnNpMw0hg2VHAYsAxmkHXBYroNangj2NTBQDvw=
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
@@ -173,16 +173,16 @@ github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0 h1:1f7EeD0lfPHoXfaJDSL7cxRcSRelbsAKgF3MGXY+Uyo=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0/go.mod h1:tToO1PjGkLIR+9DbJ0wrKicYma0H/EUHXOpwel6Dw+0=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0 h1:EEZqu1PNRSmm+7Cqm9A/8+ObgfbMzhE1ps9Z3LD7HgM=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.0/go.mod h1:LHrxY+2IzNTHVTPG/s5yaz1VmXbj+CQ7Hr5SeVkHiTw=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.4 h1:ntAPahCjQwQ79CC6tI67QDgj17NTWp+lMd1SaL2jJhs=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.4/go.mod h1:/350+9clTW5ktUvF+hePMN9yDknB2ipslqcx3Y2rLDQ=
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.5-0.20251017101031-c02148cd6b8b h1:f866FHfg85dSbO3A8w1PLOyZm0IERqD4q0nutIubDHU=
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.5-0.20251017101031-c02148cd6b8b/go.mod h1:FCGqaKJdbpqLdGkOPb/u2sfJxqQbJecqU5F9D9hCRC4=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.4 h1:iKXUQ+8TklSriAqOQjfwioI36zlByqrDqz4ISaRFvm8=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.4/go.mod h1:PYVwyQ0gN+w3wL7zKAoeUpy2WFs4/V8+Ls+eNsy7Uo0=
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.7.4 h1:JnUjXb7C9vmwcZFwXqnxi9H4/I0rir9LmRryIX7xNds=
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.7.4/go.mod h1:A3NhV8u45twLq5VdqObhYNhT4szLFLCROw4LzHM+lYg=
github.com/gogf/gf/v2 v2.9.0 h1:semN5Q5qGjDQEv4620VzxcJzJlSD07gmyJ9Sy9zfbHk=
github.com/gogf/gf/v2 v2.9.0/go.mod h1:sWGQw+pLILtuHmbOxoe0D+0DdaXxbleT57axOLH2vKI=
github.com/gogf/gf/v2 v2.9.1-0.20250624075347-5fa656d1cc92 h1:ydiVI+0OGCH8eeuAq+P6XzyIX7CCbYose+AFvJdMD7k=
github.com/gogf/gf/v2 v2.9.1-0.20250624075347-5fa656d1cc92/go.mod h1:sWGQw+pLILtuHmbOxoe0D+0DdaXxbleT57axOLH2vKI=
github.com/gogf/gf/v2 v2.9.4 h1:6vleEWypot9WBPncP2GjbpgAUeG6Mzb1YESb9nPMkjY=
github.com/gogf/gf/v2 v2.9.4/go.mod h1:Ukl+5HUH9S7puBmNLR4L1zUqeRwi0nrW4OigOknEztU=
github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f h1:7xfXR/BhG3JDqO1s45n65Oyx9t4E/UqDOXep6jXdLCM=
github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f/go.mod h1:HnYoio6S7VaFJdryKcD/r9HgX+4QzYfr00XiXUo/xz0=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
@@ -287,16 +287,16 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE=
github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/minio/crc64nvme v1.0.1 h1:DHQPrYPdqK7jQG/Ls5CTBZWeex/2FMS3G5XGkycuFrY=
@@ -325,14 +325,12 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 h1:r3FaAI0NZK3hSmtTDrBVREhKULp8oUeqLT5Eyl2mSPo=
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
github.com/olekukonko/ll v0.0.8 h1:sbGZ1Fx4QxJXEqL/6IG8GEFnYojUSQ45dJVwN2FH2fc=
github.com/olekukonko/ll v0.0.8/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/olekukonko/tablewriter v1.0.8 h1:f6wJzHg4QUtJdvrVPKco4QTrAylgaU0+b9br/lJxEiQ=
github.com/olekukonko/tablewriter v1.0.8/go.mod h1:H428M+HzoUXC6JU2Abj9IT9ooRmdq9CxuDmKMtrOCMs=
github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM=
github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI=
github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g=
github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY=
github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
@@ -364,8 +362,8 @@ github.com/qiniu/go-sdk/v7 v7.25.4/go.mod h1:dmKtJ2ahhPWFVi9o1D5GemmWoh/ctuB9peq
github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
github.com/redis/go-redis/v9 v9.12.1 h1:k5iquqv27aBtnTm2tIkROUDp8JBXhXZIVu1InSgvovg=
github.com/redis/go-redis/v9 v9.12.1/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
@@ -415,8 +413,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.563/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1200/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1202 h1:3QTQZXLLGLALyHNHs6WAsFCWvElMEXfOdaFM01/3Zjo=
@@ -462,18 +460,22 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
go.opentelemetry.io/otel/exporters/jaeger v1.14.0 h1:CjbUNd4iN2hHmWekmOqZ+zSCU+dzZppG8XsV+A3oc8Q=
go.opentelemetry.io/otel/exporters/jaeger v1.14.0/go.mod h1:4Ay9kk5vELRrbg5z4cpP9EtmQRFap2Wb0woPG4lujZA=
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4=
go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU=
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
go.uber.org/atomic v1.5.1 h1:rsqfU5vBkVknbhUGbAUwQKR2H4ItV8tjJ+6kJX4cxHM=
go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -492,8 +494,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY=
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
@@ -510,8 +512,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -539,8 +541,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -554,8 +556,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -581,7 +583,6 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -593,8 +594,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -608,8 +609,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -622,8 +623,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -641,8 +642,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo=
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg=
golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@@ -23,6 +23,7 @@ gfcli:
gen:
dao:
- link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true&charset=utf8mb4"
# - link: "pgsql:postgres:hg123456@tcp(127.0.0.1:5432)/hotgo"
group: "default" # 分组 使用hotgo代码生成功能时必须填
# tables: "" # 指定当前数据库中需要执行代码生成的数据表如果为空表示数据库的所有表都会生成
tablesEx: "hg_sys_addons_install" # 指定当前数据库中需要排除代码生成的数据表

View File

@@ -1,6 +1,6 @@
// Package consts
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package consts
@@ -14,6 +14,7 @@ const (
Unknown = "Unknown" // Unknown
SuperRoleKey = "super" // 超管角色唯一标识符,通过角色验证超管
MaxServeLogContentLen = 2048 // 最大保留服务日志内容大小
SysDefaultLanguage = "zh_CN" // 系统默认语言,当配置文件没有国际化配置时生效
)
// curd.
@@ -29,3 +30,8 @@ const (
MerchantId = "merchant_id" // 商户ID
UserId = "user_id" // 用户ID
)
const (
DBMysql = "mysql"
DBPgsql = "pgsql"
)

View File

@@ -1,11 +1,11 @@
// Package consts
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package consts
// VersionApp HotGo版本
const (
VersionApp = "2.17.8"
VersionApp = "2.18.6"
)

View File

@@ -7,6 +7,7 @@ package common
import (
"context"
"github.com/gogf/gf/v2/i18n/gi18n"
"hotgo/api/admin/common"
"hotgo/internal/consts"
"hotgo/internal/library/captcha"
@@ -90,6 +91,9 @@ func (c *cSite) LoginConfig(ctx context.Context, _ *common.SiteLoginConfigReq) (
}
res.LoginConfig = login
res.I18nSwitch = g.Cfg().MustGet(ctx, "system.i18n.switch", true).Bool()
res.DefaultLanguage = g.Cfg().MustGet(ctx, "system.i18n.defaultLanguage", consts.SysDefaultLanguage).String()
res.ProjectName = gi18n.T(ctx, "HotGo管理系统")
return
}

View File

@@ -57,3 +57,10 @@ func (c *cUpload) UploadPart(ctx context.Context, req *common.UploadPartReq) (re
res.UploadPartModel = data
return
}
// ImageTransferStorage 图片链接转存
func (c *cUpload) ImageTransferStorage(ctx context.Context, req *common.ImageTransferStorageReq) (res *common.ImageTransferStorageRes, err error) {
res = new(common.ImageTransferStorageRes)
res.ImageTransferStorageModel, err = service.CommonUpload().ImageTransferStorage(ctx, &req.ImageTransferStorageInp)
return
}

View File

@@ -1,9 +1,9 @@
// Package sys
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
// @AutoGenerate Version 2.18.6
package sys
import (
@@ -88,4 +88,4 @@ func (c *cCurdDemo) Status(ctx context.Context, req *curddemo.StatusReq) (res *c
func (c *cCurdDemo) Switch(ctx context.Context, req *curddemo.SwitchReq) (res *curddemo.SwitchRes, err error) {
err = service.SysCurdDemo().Switch(ctx, &req.CurdDemoSwitchInp)
return
}
}

View File

@@ -1,9 +1,9 @@
// Package sys
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
// @AutoGenerate Version 2.17.8
package sys
import (
@@ -86,4 +86,4 @@ func (c *cOptionTreeDemo) TreeOption(ctx context.Context, req *optiontreedemo.Tr
res = &temp
}
return
}
}

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAddonHgexampleTableDao is internal type for wrapping internal DAO implements.
type internalAddonHgexampleTableDao = *internal.AddonHgexampleTableDao
// addonHgexampleTableDao is the data access object for table hg_addon_hgexample_table.
// You can define custom methods on it to extend its functionality as you wish.
// addonHgexampleTableDao is the data access object for the table hg_addon_hgexample_table.
// You can define custom methods on it to extend its functionality as needed.
type addonHgexampleTableDao struct {
internalAddonHgexampleTableDao
*internal.AddonHgexampleTableDao
}
var (
// AddonHgexampleTable is globally public accessible object for table hg_addon_hgexample_table operations.
AddonHgexampleTable = addonHgexampleTableDao{
internal.NewAddonHgexampleTableDao(),
}
// AddonHgexampleTable is a globally accessible object for table hg_addon_hgexample_table operations.
AddonHgexampleTable = addonHgexampleTableDao{internal.NewAddonHgexampleTableDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAddonHgexampleTenantOrderDao is internal type for wrapping internal DAO implements.
type internalAddonHgexampleTenantOrderDao = *internal.AddonHgexampleTenantOrderDao
// addonHgexampleTenantOrderDao is the data access object for table hg_addon_hgexample_tenant_order.
// You can define custom methods on it to extend its functionality as you wish.
// addonHgexampleTenantOrderDao is the data access object for the table hg_addon_hgexample_tenant_order.
// You can define custom methods on it to extend its functionality as needed.
type addonHgexampleTenantOrderDao struct {
internalAddonHgexampleTenantOrderDao
*internal.AddonHgexampleTenantOrderDao
}
var (
// AddonHgexampleTenantOrder is globally public accessible object for table hg_addon_hgexample_tenant_order operations.
AddonHgexampleTenantOrder = addonHgexampleTenantOrderDao{
internal.NewAddonHgexampleTenantOrderDao(),
}
// AddonHgexampleTenantOrder is a globally accessible object for table hg_addon_hgexample_tenant_order operations.
AddonHgexampleTenantOrder = addonHgexampleTenantOrderDao{internal.NewAddonHgexampleTenantOrderDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminCashDao is internal type for wrapping internal DAO implements.
type internalAdminCashDao = *internal.AdminCashDao
// adminCashDao is the data access object for table hg_admin_cash.
// You can define custom methods on it to extend its functionality as you wish.
// adminCashDao is the data access object for the table hg_admin_cash.
// You can define custom methods on it to extend its functionality as needed.
type adminCashDao struct {
internalAdminCashDao
*internal.AdminCashDao
}
var (
// AdminCash is globally public accessible object for table hg_admin_cash operations.
AdminCash = adminCashDao{
internal.NewAdminCashDao(),
}
// AdminCash is a globally accessible object for table hg_admin_cash operations.
AdminCash = adminCashDao{internal.NewAdminCashDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminCreditsLogDao is internal type for wrapping internal DAO implements.
type internalAdminCreditsLogDao = *internal.AdminCreditsLogDao
// adminCreditsLogDao is the data access object for table hg_admin_credits_log.
// You can define custom methods on it to extend its functionality as you wish.
// adminCreditsLogDao is the data access object for the table hg_admin_credits_log.
// You can define custom methods on it to extend its functionality as needed.
type adminCreditsLogDao struct {
internalAdminCreditsLogDao
*internal.AdminCreditsLogDao
}
var (
// AdminCreditsLog is globally public accessible object for table hg_admin_credits_log operations.
AdminCreditsLog = adminCreditsLogDao{
internal.NewAdminCreditsLogDao(),
}
// AdminCreditsLog is a globally accessible object for table hg_admin_credits_log operations.
AdminCreditsLog = adminCreditsLogDao{internal.NewAdminCreditsLogDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminDeptDao is internal type for wrapping internal DAO implements.
type internalAdminDeptDao = *internal.AdminDeptDao
// adminDeptDao is the data access object for table hg_admin_dept.
// You can define custom methods on it to extend its functionality as you wish.
// adminDeptDao is the data access object for the table hg_admin_dept.
// You can define custom methods on it to extend its functionality as needed.
type adminDeptDao struct {
internalAdminDeptDao
*internal.AdminDeptDao
}
var (
// AdminDept is globally public accessible object for table hg_admin_dept operations.
AdminDept = adminDeptDao{
internal.NewAdminDeptDao(),
}
// AdminDept is a globally accessible object for table hg_admin_dept operations.
AdminDept = adminDeptDao{internal.NewAdminDeptDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminMemberDao is internal type for wrapping internal DAO implements.
type internalAdminMemberDao = *internal.AdminMemberDao
// adminMemberDao is the data access object for table hg_admin_member.
// You can define custom methods on it to extend its functionality as you wish.
// adminMemberDao is the data access object for the table hg_admin_member.
// You can define custom methods on it to extend its functionality as needed.
type adminMemberDao struct {
internalAdminMemberDao
*internal.AdminMemberDao
}
var (
// AdminMember is globally public accessible object for table hg_admin_member operations.
AdminMember = adminMemberDao{
internal.NewAdminMemberDao(),
}
// AdminMember is a globally accessible object for table hg_admin_member operations.
AdminMember = adminMemberDao{internal.NewAdminMemberDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminMemberPostDao is internal type for wrapping internal DAO implements.
type internalAdminMemberPostDao = *internal.AdminMemberPostDao
// adminMemberPostDao is the data access object for table hg_admin_member_post.
// You can define custom methods on it to extend its functionality as you wish.
// adminMemberPostDao is the data access object for the table hg_admin_member_post.
// You can define custom methods on it to extend its functionality as needed.
type adminMemberPostDao struct {
internalAdminMemberPostDao
*internal.AdminMemberPostDao
}
var (
// AdminMemberPost is globally public accessible object for table hg_admin_member_post operations.
AdminMemberPost = adminMemberPostDao{
internal.NewAdminMemberPostDao(),
}
// AdminMemberPost is a globally accessible object for table hg_admin_member_post operations.
AdminMemberPost = adminMemberPostDao{internal.NewAdminMemberPostDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminMemberRoleDao is internal type for wrapping internal DAO implements.
type internalAdminMemberRoleDao = *internal.AdminMemberRoleDao
// adminMemberRoleDao is the data access object for table hg_admin_member_role.
// You can define custom methods on it to extend its functionality as you wish.
// adminMemberRoleDao is the data access object for the table hg_admin_member_role.
// You can define custom methods on it to extend its functionality as needed.
type adminMemberRoleDao struct {
internalAdminMemberRoleDao
*internal.AdminMemberRoleDao
}
var (
// AdminMemberRole is globally public accessible object for table hg_admin_member_role operations.
AdminMemberRole = adminMemberRoleDao{
internal.NewAdminMemberRoleDao(),
}
// AdminMemberRole is a globally accessible object for table hg_admin_member_role operations.
AdminMemberRole = adminMemberRoleDao{internal.NewAdminMemberRoleDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminMenuDao is internal type for wrapping internal DAO implements.
type internalAdminMenuDao = *internal.AdminMenuDao
// adminMenuDao is the data access object for table hg_admin_menu.
// You can define custom methods on it to extend its functionality as you wish.
// adminMenuDao is the data access object for the table hg_admin_menu.
// You can define custom methods on it to extend its functionality as needed.
type adminMenuDao struct {
internalAdminMenuDao
*internal.AdminMenuDao
}
var (
// AdminMenu is globally public accessible object for table hg_admin_menu operations.
AdminMenu = adminMenuDao{
internal.NewAdminMenuDao(),
}
// AdminMenu is a globally accessible object for table hg_admin_menu operations.
AdminMenu = adminMenuDao{internal.NewAdminMenuDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminNoticeDao is internal type for wrapping internal DAO implements.
type internalAdminNoticeDao = *internal.AdminNoticeDao
// adminNoticeDao is the data access object for table hg_admin_notice.
// You can define custom methods on it to extend its functionality as you wish.
// adminNoticeDao is the data access object for the table hg_admin_notice.
// You can define custom methods on it to extend its functionality as needed.
type adminNoticeDao struct {
internalAdminNoticeDao
*internal.AdminNoticeDao
}
var (
// AdminNotice is globally public accessible object for table hg_admin_notice operations.
AdminNotice = adminNoticeDao{
internal.NewAdminNoticeDao(),
}
// AdminNotice is a globally accessible object for table hg_admin_notice operations.
AdminNotice = adminNoticeDao{internal.NewAdminNoticeDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminNoticeReadDao is internal type for wrapping internal DAO implements.
type internalAdminNoticeReadDao = *internal.AdminNoticeReadDao
// adminNoticeReadDao is the data access object for table hg_admin_notice_read.
// You can define custom methods on it to extend its functionality as you wish.
// adminNoticeReadDao is the data access object for the table hg_admin_notice_read.
// You can define custom methods on it to extend its functionality as needed.
type adminNoticeReadDao struct {
internalAdminNoticeReadDao
*internal.AdminNoticeReadDao
}
var (
// AdminNoticeRead is globally public accessible object for table hg_admin_notice_read operations.
AdminNoticeRead = adminNoticeReadDao{
internal.NewAdminNoticeReadDao(),
}
// AdminNoticeRead is a globally accessible object for table hg_admin_notice_read operations.
AdminNoticeRead = adminNoticeReadDao{internal.NewAdminNoticeReadDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminOauthDao is internal type for wrapping internal DAO implements.
type internalAdminOauthDao = *internal.AdminOauthDao
// adminOauthDao is the data access object for table hg_admin_oauth.
// You can define custom methods on it to extend its functionality as you wish.
// adminOauthDao is the data access object for the table hg_admin_oauth.
// You can define custom methods on it to extend its functionality as needed.
type adminOauthDao struct {
internalAdminOauthDao
*internal.AdminOauthDao
}
var (
// AdminOauth is globally public accessible object for table hg_admin_oauth operations.
AdminOauth = adminOauthDao{
internal.NewAdminOauthDao(),
}
// AdminOauth is a globally accessible object for table hg_admin_oauth operations.
AdminOauth = adminOauthDao{internal.NewAdminOauthDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminOrderDao is internal type for wrapping internal DAO implements.
type internalAdminOrderDao = *internal.AdminOrderDao
// adminOrderDao is the data access object for table hg_admin_order.
// You can define custom methods on it to extend its functionality as you wish.
// adminOrderDao is the data access object for the table hg_admin_order.
// You can define custom methods on it to extend its functionality as needed.
type adminOrderDao struct {
internalAdminOrderDao
*internal.AdminOrderDao
}
var (
// AdminOrder is globally public accessible object for table hg_admin_order operations.
AdminOrder = adminOrderDao{
internal.NewAdminOrderDao(),
}
// AdminOrder is a globally accessible object for table hg_admin_order operations.
AdminOrder = adminOrderDao{internal.NewAdminOrderDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminPostDao is internal type for wrapping internal DAO implements.
type internalAdminPostDao = *internal.AdminPostDao
// adminPostDao is the data access object for table hg_admin_post.
// You can define custom methods on it to extend its functionality as you wish.
// adminPostDao is the data access object for the table hg_admin_post.
// You can define custom methods on it to extend its functionality as needed.
type adminPostDao struct {
internalAdminPostDao
*internal.AdminPostDao
}
var (
// AdminPost is globally public accessible object for table hg_admin_post operations.
AdminPost = adminPostDao{
internal.NewAdminPostDao(),
}
// AdminPost is a globally accessible object for table hg_admin_post operations.
AdminPost = adminPostDao{internal.NewAdminPostDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminRoleDao is internal type for wrapping internal DAO implements.
type internalAdminRoleDao = *internal.AdminRoleDao
// adminRoleDao is the data access object for table hg_admin_role.
// You can define custom methods on it to extend its functionality as you wish.
// adminRoleDao is the data access object for the table hg_admin_role.
// You can define custom methods on it to extend its functionality as needed.
type adminRoleDao struct {
internalAdminRoleDao
*internal.AdminRoleDao
}
var (
// AdminRole is globally public accessible object for table hg_admin_role operations.
AdminRole = adminRoleDao{
internal.NewAdminRoleDao(),
}
// AdminRole is a globally accessible object for table hg_admin_role operations.
AdminRole = adminRoleDao{internal.NewAdminRoleDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminRoleCasbinDao is internal type for wrapping internal DAO implements.
type internalAdminRoleCasbinDao = *internal.AdminRoleCasbinDao
// adminRoleCasbinDao is the data access object for table hg_admin_role_casbin.
// You can define custom methods on it to extend its functionality as you wish.
// adminRoleCasbinDao is the data access object for the table hg_admin_role_casbin.
// You can define custom methods on it to extend its functionality as needed.
type adminRoleCasbinDao struct {
internalAdminRoleCasbinDao
*internal.AdminRoleCasbinDao
}
var (
// AdminRoleCasbin is globally public accessible object for table hg_admin_role_casbin operations.
AdminRoleCasbin = adminRoleCasbinDao{
internal.NewAdminRoleCasbinDao(),
}
// AdminRoleCasbin is a globally accessible object for table hg_admin_role_casbin operations.
AdminRoleCasbin = adminRoleCasbinDao{internal.NewAdminRoleCasbinDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalAdminRoleMenuDao is internal type for wrapping internal DAO implements.
type internalAdminRoleMenuDao = *internal.AdminRoleMenuDao
// adminRoleMenuDao is the data access object for table hg_admin_role_menu.
// You can define custom methods on it to extend its functionality as you wish.
// adminRoleMenuDao is the data access object for the table hg_admin_role_menu.
// You can define custom methods on it to extend its functionality as needed.
type adminRoleMenuDao struct {
internalAdminRoleMenuDao
*internal.AdminRoleMenuDao
}
var (
// AdminRoleMenu is globally public accessible object for table hg_admin_role_menu operations.
AdminRoleMenu = adminRoleMenuDao{
internal.NewAdminRoleMenuDao(),
}
// AdminRoleMenu is a globally accessible object for table hg_admin_role_menu operations.
AdminRoleMenu = adminRoleMenuDao{internal.NewAdminRoleMenuDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -25,7 +25,7 @@ type SysAddonsConfigColumns struct {
AddonName string // 插件名称
Group string // 分组
Name string // 参数名称
Type string // 键值类型:string,int,uint,bool,datetime,date
Type string // 键值类型:string,int,uint,bool,TIMESTAMP,date
Key string // 参数键名
Value string // 参数键值
DefaultValue string // 默认值

View File

@@ -24,7 +24,7 @@ type SysConfigColumns struct {
Id string // 配置ID
Group string // 配置分组
Name string // 参数名称
Type string // 键值类型:string,int,uint,bool,datetime,date
Type string // 键值类型:string,int,uint,bool,TIMESTAMP,date
Key string // 参数键名
Value string // 参数键值
DefaultValue string // 默认值

View File

@@ -24,7 +24,7 @@ type SysDictDataColumns struct {
Id string // 字典数据ID
Label string // 字典标签
Value string // 字典键值
ValueType string // 键值数据类型string,int,uint,bool,datetime,date
ValueType string // 键值数据类型string,int,uint,bool,TIMESTAMP,date
Type string // 字典类型
ListClass string // 表格回显样式
IsDefault string // 是否为系统默认

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalPayLogDao is internal type for wrapping internal DAO implements.
type internalPayLogDao = *internal.PayLogDao
// payLogDao is the data access object for table hg_pay_log.
// You can define custom methods on it to extend its functionality as you wish.
// payLogDao is the data access object for the table hg_pay_log.
// You can define custom methods on it to extend its functionality as needed.
type payLogDao struct {
internalPayLogDao
*internal.PayLogDao
}
var (
// PayLog is globally public accessible object for table hg_pay_log operations.
PayLog = payLogDao{
internal.NewPayLogDao(),
}
// PayLog is a globally accessible object for table hg_pay_log operations.
PayLog = payLogDao{internal.NewPayLogDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalPayRefundDao is internal type for wrapping internal DAO implements.
type internalPayRefundDao = *internal.PayRefundDao
// payRefundDao is the data access object for table hg_pay_refund.
// You can define custom methods on it to extend its functionality as you wish.
// payRefundDao is the data access object for the table hg_pay_refund.
// You can define custom methods on it to extend its functionality as needed.
type payRefundDao struct {
internalPayRefundDao
*internal.PayRefundDao
}
var (
// PayRefund is globally public accessible object for table hg_pay_refund operations.
PayRefund = payRefundDao{
internal.NewPayRefundDao(),
}
// PayRefund is a globally accessible object for table hg_pay_refund operations.
PayRefund = payRefundDao{internal.NewPayRefundDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysAddonsConfigDao is internal type for wrapping internal DAO implements.
type internalSysAddonsConfigDao = *internal.SysAddonsConfigDao
// sysAddonsConfigDao is the data access object for table hg_sys_addons_config.
// You can define custom methods on it to extend its functionality as you wish.
// sysAddonsConfigDao is the data access object for the table hg_sys_addons_config.
// You can define custom methods on it to extend its functionality as needed.
type sysAddonsConfigDao struct {
internalSysAddonsConfigDao
*internal.SysAddonsConfigDao
}
var (
// SysAddonsConfig is globally public accessible object for table hg_sys_addons_config operations.
SysAddonsConfig = sysAddonsConfigDao{
internal.NewSysAddonsConfigDao(),
}
// SysAddonsConfig is a globally accessible object for table hg_sys_addons_config operations.
SysAddonsConfig = sysAddonsConfigDao{internal.NewSysAddonsConfigDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysAttachmentDao is internal type for wrapping internal DAO implements.
type internalSysAttachmentDao = *internal.SysAttachmentDao
// sysAttachmentDao is the data access object for table hg_sys_attachment.
// You can define custom methods on it to extend its functionality as you wish.
// sysAttachmentDao is the data access object for the table hg_sys_attachment.
// You can define custom methods on it to extend its functionality as needed.
type sysAttachmentDao struct {
internalSysAttachmentDao
*internal.SysAttachmentDao
}
var (
// SysAttachment is globally public accessible object for table hg_sys_attachment operations.
SysAttachment = sysAttachmentDao{
internal.NewSysAttachmentDao(),
}
// SysAttachment is a globally accessible object for table hg_sys_attachment operations.
SysAttachment = sysAttachmentDao{internal.NewSysAttachmentDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysBlacklistDao is internal type for wrapping internal DAO implements.
type internalSysBlacklistDao = *internal.SysBlacklistDao
// sysBlacklistDao is the data access object for table hg_sys_blacklist.
// You can define custom methods on it to extend its functionality as you wish.
// sysBlacklistDao is the data access object for the table hg_sys_blacklist.
// You can define custom methods on it to extend its functionality as needed.
type sysBlacklistDao struct {
internalSysBlacklistDao
*internal.SysBlacklistDao
}
var (
// SysBlacklist is globally public accessible object for table hg_sys_blacklist operations.
SysBlacklist = sysBlacklistDao{
internal.NewSysBlacklistDao(),
}
// SysBlacklist is a globally accessible object for table hg_sys_blacklist operations.
SysBlacklist = sysBlacklistDao{internal.NewSysBlacklistDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysConfigDao is internal type for wrapping internal DAO implements.
type internalSysConfigDao = *internal.SysConfigDao
// sysConfigDao is the data access object for table hg_sys_config.
// You can define custom methods on it to extend its functionality as you wish.
// sysConfigDao is the data access object for the table hg_sys_config.
// You can define custom methods on it to extend its functionality as needed.
type sysConfigDao struct {
internalSysConfigDao
*internal.SysConfigDao
}
var (
// SysConfig is globally public accessible object for table hg_sys_config operations.
SysConfig = sysConfigDao{
internal.NewSysConfigDao(),
}
// SysConfig is a globally accessible object for table hg_sys_config operations.
SysConfig = sysConfigDao{internal.NewSysConfigDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysCronDao is internal type for wrapping internal DAO implements.
type internalSysCronDao = *internal.SysCronDao
// sysCronDao is the data access object for table hg_sys_cron.
// You can define custom methods on it to extend its functionality as you wish.
// sysCronDao is the data access object for the table hg_sys_cron.
// You can define custom methods on it to extend its functionality as needed.
type sysCronDao struct {
internalSysCronDao
*internal.SysCronDao
}
var (
// SysCron is globally public accessible object for table hg_sys_cron operations.
SysCron = sysCronDao{
internal.NewSysCronDao(),
}
// SysCron is a globally accessible object for table hg_sys_cron operations.
SysCron = sysCronDao{internal.NewSysCronDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysCronGroupDao is internal type for wrapping internal DAO implements.
type internalSysCronGroupDao = *internal.SysCronGroupDao
// sysCronGroupDao is the data access object for table hg_sys_cron_group.
// You can define custom methods on it to extend its functionality as you wish.
// sysCronGroupDao is the data access object for the table hg_sys_cron_group.
// You can define custom methods on it to extend its functionality as needed.
type sysCronGroupDao struct {
internalSysCronGroupDao
*internal.SysCronGroupDao
}
var (
// SysCronGroup is globally public accessible object for table hg_sys_cron_group operations.
SysCronGroup = sysCronGroupDao{
internal.NewSysCronGroupDao(),
}
// SysCronGroup is a globally accessible object for table hg_sys_cron_group operations.
SysCronGroup = sysCronGroupDao{internal.NewSysCronGroupDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysDictDataDao is internal type for wrapping internal DAO implements.
type internalSysDictDataDao = *internal.SysDictDataDao
// sysDictDataDao is the data access object for table hg_sys_dict_data.
// You can define custom methods on it to extend its functionality as you wish.
// sysDictDataDao is the data access object for the table hg_sys_dict_data.
// You can define custom methods on it to extend its functionality as needed.
type sysDictDataDao struct {
internalSysDictDataDao
*internal.SysDictDataDao
}
var (
// SysDictData is globally public accessible object for table hg_sys_dict_data operations.
SysDictData = sysDictDataDao{
internal.NewSysDictDataDao(),
}
// SysDictData is a globally accessible object for table hg_sys_dict_data operations.
SysDictData = sysDictDataDao{internal.NewSysDictDataDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysDictTypeDao is internal type for wrapping internal DAO implements.
type internalSysDictTypeDao = *internal.SysDictTypeDao
// sysDictTypeDao is the data access object for table hg_sys_dict_type.
// You can define custom methods on it to extend its functionality as you wish.
// sysDictTypeDao is the data access object for the table hg_sys_dict_type.
// You can define custom methods on it to extend its functionality as needed.
type sysDictTypeDao struct {
internalSysDictTypeDao
*internal.SysDictTypeDao
}
var (
// SysDictType is globally public accessible object for table hg_sys_dict_type operations.
SysDictType = sysDictTypeDao{
internal.NewSysDictTypeDao(),
}
// SysDictType is a globally accessible object for table hg_sys_dict_type operations.
SysDictType = sysDictTypeDao{internal.NewSysDictTypeDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysEmsLogDao is internal type for wrapping internal DAO implements.
type internalSysEmsLogDao = *internal.SysEmsLogDao
// sysEmsLogDao is the data access object for table hg_sys_ems_log.
// You can define custom methods on it to extend its functionality as you wish.
// sysEmsLogDao is the data access object for the table hg_sys_ems_log.
// You can define custom methods on it to extend its functionality as needed.
type sysEmsLogDao struct {
internalSysEmsLogDao
*internal.SysEmsLogDao
}
var (
// SysEmsLog is globally public accessible object for table hg_sys_ems_log operations.
SysEmsLog = sysEmsLogDao{
internal.NewSysEmsLogDao(),
}
// SysEmsLog is a globally accessible object for table hg_sys_ems_log operations.
SysEmsLog = sysEmsLogDao{internal.NewSysEmsLogDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysGenCodesDao is internal type for wrapping internal DAO implements.
type internalSysGenCodesDao = *internal.SysGenCodesDao
// sysGenCodesDao is the data access object for table hg_sys_gen_codes.
// You can define custom methods on it to extend its functionality as you wish.
// sysGenCodesDao is the data access object for the table hg_sys_gen_codes.
// You can define custom methods on it to extend its functionality as needed.
type sysGenCodesDao struct {
internalSysGenCodesDao
*internal.SysGenCodesDao
}
var (
// SysGenCodes is globally public accessible object for table hg_sys_gen_codes operations.
SysGenCodes = sysGenCodesDao{
internal.NewSysGenCodesDao(),
}
// SysGenCodes is a globally accessible object for table hg_sys_gen_codes operations.
SysGenCodes = sysGenCodesDao{internal.NewSysGenCodesDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysGenCurdDemoDao is internal type for wrapping internal DAO implements.
type internalSysGenCurdDemoDao = *internal.SysGenCurdDemoDao
// sysGenCurdDemoDao is the data access object for table hg_sys_gen_curd_demo.
// You can define custom methods on it to extend its functionality as you wish.
// sysGenCurdDemoDao is the data access object for the table hg_sys_gen_curd_demo.
// You can define custom methods on it to extend its functionality as needed.
type sysGenCurdDemoDao struct {
internalSysGenCurdDemoDao
*internal.SysGenCurdDemoDao
}
var (
// SysGenCurdDemo is globally public accessible object for table hg_sys_gen_curd_demo operations.
SysGenCurdDemo = sysGenCurdDemoDao{
internal.NewSysGenCurdDemoDao(),
}
// SysGenCurdDemo is a globally accessible object for table hg_sys_gen_curd_demo operations.
SysGenCurdDemo = sysGenCurdDemoDao{internal.NewSysGenCurdDemoDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysGenTreeDemoDao is internal type for wrapping internal DAO implements.
type internalSysGenTreeDemoDao = *internal.SysGenTreeDemoDao
// sysGenTreeDemoDao is the data access object for table hg_sys_gen_tree_demo.
// You can define custom methods on it to extend its functionality as you wish.
// sysGenTreeDemoDao is the data access object for the table hg_sys_gen_tree_demo.
// You can define custom methods on it to extend its functionality as needed.
type sysGenTreeDemoDao struct {
internalSysGenTreeDemoDao
*internal.SysGenTreeDemoDao
}
var (
// SysGenTreeDemo is globally public accessible object for table hg_sys_gen_tree_demo operations.
SysGenTreeDemo = sysGenTreeDemoDao{
internal.NewSysGenTreeDemoDao(),
}
// SysGenTreeDemo is a globally accessible object for table hg_sys_gen_tree_demo operations.
SysGenTreeDemo = sysGenTreeDemoDao{internal.NewSysGenTreeDemoDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysLogDao is internal type for wrapping internal DAO implements.
type internalSysLogDao = *internal.SysLogDao
// sysLogDao is the data access object for table hg_sys_log.
// You can define custom methods on it to extend its functionality as you wish.
// sysLogDao is the data access object for the table hg_sys_log.
// You can define custom methods on it to extend its functionality as needed.
type sysLogDao struct {
internalSysLogDao
*internal.SysLogDao
}
var (
// SysLog is globally public accessible object for table hg_sys_log operations.
SysLog = sysLogDao{
internal.NewSysLogDao(),
}
// SysLog is a globally accessible object for table hg_sys_log operations.
SysLog = sysLogDao{internal.NewSysLogDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysLoginLogDao is internal type for wrapping internal DAO implements.
type internalSysLoginLogDao = *internal.SysLoginLogDao
// sysLoginLogDao is the data access object for table hg_sys_login_log.
// You can define custom methods on it to extend its functionality as you wish.
// sysLoginLogDao is the data access object for the table hg_sys_login_log.
// You can define custom methods on it to extend its functionality as needed.
type sysLoginLogDao struct {
internalSysLoginLogDao
*internal.SysLoginLogDao
}
var (
// SysLoginLog is globally public accessible object for table hg_sys_login_log operations.
SysLoginLog = sysLoginLogDao{
internal.NewSysLoginLogDao(),
}
// SysLoginLog is a globally accessible object for table hg_sys_login_log operations.
SysLoginLog = sysLoginLogDao{internal.NewSysLoginLogDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysProvincesDao is internal type for wrapping internal DAO implements.
type internalSysProvincesDao = *internal.SysProvincesDao
// sysProvincesDao is the data access object for table hg_sys_provinces.
// You can define custom methods on it to extend its functionality as you wish.
// sysProvincesDao is the data access object for the table hg_sys_provinces.
// You can define custom methods on it to extend its functionality as needed.
type sysProvincesDao struct {
internalSysProvincesDao
*internal.SysProvincesDao
}
var (
// SysProvinces is globally public accessible object for table hg_sys_provinces operations.
SysProvinces = sysProvincesDao{
internal.NewSysProvincesDao(),
}
// SysProvinces is a globally accessible object for table hg_sys_provinces operations.
SysProvinces = sysProvincesDao{internal.NewSysProvincesDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysServeLicenseDao is internal type for wrapping internal DAO implements.
type internalSysServeLicenseDao = *internal.SysServeLicenseDao
// sysServeLicenseDao is the data access object for table hg_sys_serve_license.
// You can define custom methods on it to extend its functionality as you wish.
// sysServeLicenseDao is the data access object for the table hg_sys_serve_license.
// You can define custom methods on it to extend its functionality as needed.
type sysServeLicenseDao struct {
internalSysServeLicenseDao
*internal.SysServeLicenseDao
}
var (
// SysServeLicense is globally public accessible object for table hg_sys_serve_license operations.
SysServeLicense = sysServeLicenseDao{
internal.NewSysServeLicenseDao(),
}
// SysServeLicense is a globally accessible object for table hg_sys_serve_license operations.
SysServeLicense = sysServeLicenseDao{internal.NewSysServeLicenseDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysServeLogDao is internal type for wrapping internal DAO implements.
type internalSysServeLogDao = *internal.SysServeLogDao
// sysServeLogDao is the data access object for table hg_sys_serve_log.
// You can define custom methods on it to extend its functionality as you wish.
// sysServeLogDao is the data access object for the table hg_sys_serve_log.
// You can define custom methods on it to extend its functionality as needed.
type sysServeLogDao struct {
internalSysServeLogDao
*internal.SysServeLogDao
}
var (
// SysServeLog is globally public accessible object for table hg_sys_serve_log operations.
SysServeLog = sysServeLogDao{
internal.NewSysServeLogDao(),
}
// SysServeLog is a globally accessible object for table hg_sys_serve_log operations.
SysServeLog = sysServeLogDao{internal.NewSysServeLogDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalSysSmsLogDao is internal type for wrapping internal DAO implements.
type internalSysSmsLogDao = *internal.SysSmsLogDao
// sysSmsLogDao is the data access object for table hg_sys_sms_log.
// You can define custom methods on it to extend its functionality as you wish.
// sysSmsLogDao is the data access object for the table hg_sys_sms_log.
// You can define custom methods on it to extend its functionality as needed.
type sysSmsLogDao struct {
internalSysSmsLogDao
*internal.SysSmsLogDao
}
var (
// SysSmsLog is globally public accessible object for table hg_sys_sms_log operations.
SysSmsLog = sysSmsLogDao{
internal.NewSysSmsLogDao(),
}
// SysSmsLog is a globally accessible object for table hg_sys_sms_log operations.
SysSmsLog = sysSmsLogDao{internal.NewSysSmsLogDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -1,5 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
@@ -8,20 +8,15 @@ import (
"hotgo/internal/dao/internal"
)
// internalTestCategoryDao is internal type for wrapping internal DAO implements.
type internalTestCategoryDao = *internal.TestCategoryDao
// testCategoryDao is the data access object for table hg_test_category.
// You can define custom methods on it to extend its functionality as you wish.
// testCategoryDao is the data access object for the table hg_test_category.
// You can define custom methods on it to extend its functionality as needed.
type testCategoryDao struct {
internalTestCategoryDao
*internal.TestCategoryDao
}
var (
// TestCategory is globally public accessible object for table hg_test_category operations.
TestCategory = testCategoryDao{
internal.NewTestCategoryDao(),
}
// TestCategory is a globally accessible object for table hg_test_category operations.
TestCategory = testCategoryDao{internal.NewTestCategoryDao()}
)
// Fill with you ideas below.
// Add your custom methods and functionality below.

View File

@@ -9,6 +9,7 @@ import (
"context"
"errors"
"fmt"
"hotgo/internal/consts"
"hotgo/internal/dao"
"math"
"strings"
@@ -35,6 +36,23 @@ CREATE TABLE IF NOT EXISTS %s (
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '管理员_casbin权限表' ROW_FORMAT = Dynamic;
`
createPolicyTablePgSql = `CREATE TABLE IF NOT EXISTS "public"."%s" (
"id" int8 NOT NULL DEFAULT nextval('hg_admin_role_casbin_id_seq'::regclass),
"p_type" varchar(64) COLLATE "pg_catalog"."default",
"v0" varchar(256) COLLATE "pg_catalog"."default",
"v1" varchar(256) COLLATE "pg_catalog"."default",
"v2" varchar(256) COLLATE "pg_catalog"."default",
"v3" varchar(256) COLLATE "pg_catalog"."default",
"v4" varchar(256) COLLATE "pg_catalog"."default",
"v5" varchar(256) COLLATE "pg_catalog"."default",
CONSTRAINT "hg_admin_role_casbin_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."%s"
OWNER TO "postgres";
COMMENT ON TABLE "public"."%s" IS '管理员_casbin权限表';`
)
type (
@@ -106,6 +124,10 @@ func (a *adapter) model() *gdb.Model {
// create a policy table when it's not exists.
func (a *adapter) createPolicyTable() (err error) {
if a.db.GetConfig().Type == consts.DBPgsql {
_, err = a.db.Exec(context.TODO(), fmt.Sprintf(createPolicyTablePgSql, a.table, a.table, a.table))
return
}
_, err = a.db.Exec(context.TODO(), fmt.Sprintf(createPolicyTableSql, a.table))
return
}
@@ -154,7 +176,7 @@ func (a *adapter) SavePolicy(model model.Model) (err error) {
}
if count := len(policyRules); count > 0 {
if _, err = a.model().OmitEmptyData().Insert(policyRules); err != nil {
if _, err = a.model().OmitEmptyData().FieldsEx(policyColumnsName.ID).Insert(policyRules); err != nil {
return
}
}
@@ -163,7 +185,7 @@ func (a *adapter) SavePolicy(model model.Model) (err error) {
// AddPolicy adds a policy rule to the storage.
func (a *adapter) AddPolicy(sec string, ptype string, rule []string) (err error) {
_, err = a.model().OmitEmptyData().Insert(a.buildPolicyRule(ptype, rule))
_, err = a.model().OmitEmptyData().FieldsEx(policyColumnsName.ID).Insert(a.buildPolicyRule(ptype, rule))
return
}
@@ -179,7 +201,7 @@ func (a *adapter) AddPolicies(sec string, ptype string, rules [][]string) (err e
policyRules = append(policyRules, a.buildPolicyRule(ptype, rule))
}
_, err = a.model().OmitEmptyData().Insert(policyRules)
_, err = a.model().OmitEmptyData().FieldsEx(policyColumnsName.ID).Insert(policyRules)
return
}

View File

@@ -6,9 +6,10 @@
package dict
import (
"github.com/gogf/gf/v2/util/gconv"
"hash/fnv"
"hotgo/internal/model"
"github.com/gogf/gf/v2/util/gconv"
)
// GenDefaultOption 生成默认表格回显样式
@@ -122,8 +123,8 @@ func GenHashOption(key interface{}, label string, extra ...any) *model.Option {
tag := "default"
if _, err := hash.Write(gconv.Bytes(label)); err == nil {
index := int(hash.Sum32()) % len(strings)
if index < len(strings) {
index := uint32(hash.Sum32()) % uint32(len(strings))
if index < uint32(len(strings)) {
tag = strings[index]
}
}

View File

@@ -30,12 +30,10 @@ import (
"hotgo/internal/library/hggen/internal/utility/mlog"
)
var (
Build = cBuild{
nodeNameInConfigFile: "gfcli.build",
packedGoFileName: "internal/packed/build_pack_data.go",
}
)
var Build = cBuild{
nodeNameInConfigFile: "gfcli.build",
packedGoFileName: "internal/packed/build_pack_data.go",
}
type cBuild struct {
g.Meta `name:"build" brief:"{cBuildBrief}" dc:"{cBuildDc}" eg:"{cBuildEg}" ad:"{cBuildAd}"`
@@ -65,45 +63,67 @@ It provides much more features for building binary:
`
cBuildAd = `
PLATFORMS
aix ppc64
android 386,amd64,arm,arm64
darwin amd64,arm64
dragonfly amd64
freebsd 386,amd64,arm
linux 386,amd64,arm,arm64,ppc64,ppc64le,mips,mipsle,mips64,mips64le
illumos amd64
ios arm64
js wasm
linux 386,amd64,arm,arm64,loong64,mips,mipsle,mips64,mips64le,ppc64,ppc64le,riscv64,s390x
netbsd 386,amd64,arm
openbsd 386,amd64,arm
windows 386,amd64
openbsd 386,amd64,arm,arm64
plan9 386,amd64,arm
solaris amd64
wasip1 wasm
windows 386,amd64,arm,arm64
`
// https://golang.google.cn/doc/install/source
cBuildPlatforms = `
aix ppc64
android 386
android amd64
android arm
android arm64
darwin amd64
darwin arm64
ios amd64
ios arm64
dragonfly amd64
freebsd 386
freebsd amd64
freebsd arm
illumos amd64
ios arm64
js wasm
linux 386
linux amd64
linux arm
linux arm64
linux ppc64
linux ppc64le
linux loong64
linux mips
linux mipsle
linux mips64
linux mips64le
linux ppc64
linux ppc64le
linux riscv64
linux s390x
netbsd 386
netbsd amd64
netbsd arm
openbsd 386
openbsd amd64
openbsd arm
windows 386
windows amd64
android arm
dragonfly amd64
openbsd arm64
plan9 386
plan9 amd64
plan9 arm
solaris amd64
wasip1 wasm
windows 386
windows amd64
windows arm
windows arm64
`
)

View File

@@ -11,6 +11,8 @@ import (
"context"
"github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter/renderer"
"github.com/olekukonko/tablewriter/tw"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gproc"
@@ -61,10 +63,23 @@ func (c cEnv) Index(ctx context.Context, in cEnvInput) (out *cEnvOutput, err err
}
array = append(array, []string{gstr.Trim(match[1]), gstr.Trim(match[2])})
}
tw := tablewriter.NewWriter(buffer)
tw.SetColumnAlignment([]int{tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT})
tw.AppendBulk(array)
tw.Render()
table := tablewriter.NewTable(buffer,
tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
Settings: tw.Settings{
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.On},
},
Symbols: tw.NewSymbols(tw.StyleASCII),
})),
tablewriter.WithConfig(tablewriter.Config{
Row: tw.CellConfig{
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNone},
Alignment: tw.CellAlignment{PerColumn: []tw.Align{tw.AlignLeft, tw.AlignLeft}},
ColMaxWidths: tw.CellWidth{Global: 84},
},
}),
)
table.Bulk(array)
table.Render()
mlog.Print(buffer.String())
return
}

View File

@@ -11,7 +11,7 @@ import (
//_ "github.com/gogf/gf/contrib/drivers/mssql/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
//_ "github.com/gogf/gf/contrib/drivers/oracle/v2"
//_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
//_ "github.com/gogf/gf/contrib/drivers/sqlite/v2"
// do not add dm in cli pre-compilation,

View File

@@ -13,6 +13,7 @@ import (
"path/filepath"
"runtime"
"strings"
"time"
"github.com/gogf/gf/v2/container/gtype"
"github.com/gogf/gf/v2/frame/g"
@@ -26,9 +27,7 @@ import (
"hotgo/internal/library/hggen/internal/utility/mlog"
)
var (
Run = cRun{}
)
var Run = cRun{}
type cRun struct {
g.Meta `name:"run" usage:"{cRunUsage}" brief:"{cRunBrief}" eg:"{cRunEg}" dc:"{cRunDc}"`
@@ -62,9 +61,7 @@ which compiles and runs the go codes asynchronously when codes change.
cRunWatchPathsBrief = `watch additional paths for live reload, separated by ",". i.e. "manifest/config/*.yaml"`
)
var (
process *gproc.Process
)
var process *gproc.Process
func init() {
gtag.Sets(g.MapStrStr{
@@ -118,8 +115,12 @@ func (c cRun) Index(ctx context.Context, in cRunInput) (out *cRunOutput, err err
}
dirty := gtype.NewBool()
var outputPath = app.genOutputPath()
outputPath := app.genOutputPath()
callbackFunc := func(event *gfsnotify.Event) {
if !event.IsWrite() && !event.IsCreate() && !event.IsRemove() && !event.IsRename() {
return
}
if gfile.ExtName(event.Path) != "go" {
return
}
@@ -207,8 +208,37 @@ func (app *cRunApp) End(ctx context.Context, sig os.Signal, outputPath string) {
// Delete the binary file.
// firstly, kill the process.
if process != nil {
if err := process.Kill(); err != nil {
mlog.Debugf("kill process error: %s", err.Error())
if sig != nil && runtime.GOOS != "windows" {
if err := process.Signal(sig); err != nil {
mlog.Debugf("send signal to process error: %s", err.Error())
if err := process.Kill(); err != nil {
mlog.Debugf("kill process error: %s", err.Error())
}
} else {
waitCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
done := make(chan error, 1)
go func() {
select {
case <-waitCtx.Done():
done <- waitCtx.Err()
case done <- process.Wait():
}
}()
err := <-done
if err != nil {
mlog.Debugf("process wait error: %s", err.Error())
if err := process.Kill(); err != nil {
mlog.Debugf("kill process error: %s", err.Error())
}
} else {
mlog.Debug("process exited gracefully")
}
}
} else {
if err := process.Kill(); err != nil {
mlog.Debugf("kill process error: %s", err.Error())
}
}
}
if err := gfile.RemoveFile(outputPath); err != nil {

View File

@@ -15,6 +15,7 @@ import (
"github.com/gogf/gf/v2/container/gset"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/genv"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/gproc"
"github.com/gogf/gf/v2/text/gstr"
@@ -39,7 +40,11 @@ gf up
gf up -a
gf up -c
gf up -cf
gf up -a -m=install
gf up -a -m=install -p=github.com/gogf/gf/cmd/gf/v2@latest
`
cliMethodHttpDownload = "http"
cliMethodGoInstall = "install"
)
func init() {
@@ -49,10 +54,14 @@ func init() {
}
type cUpInput struct {
g.Meta `name:"up" config:"gfcli.up"`
All bool `name:"all" short:"a" brief:"upgrade both version and cli, auto fix codes" orphan:"true"`
Cli bool `name:"cli" short:"c" brief:"also upgrade CLI tool" orphan:"true"`
Fix bool `name:"fix" short:"f" brief:"auto fix codes(it only make sense if cli is to be upgraded)" orphan:"true"`
g.Meta `name:"up" config:"gfcli.up"`
All bool `name:"all" short:"a" brief:"upgrade both version and cli, auto fix codes" orphan:"true"`
Cli bool `name:"cli" short:"c" brief:"also upgrade CLI tool" orphan:"true"`
Fix bool `name:"fix" short:"f" brief:"auto fix codes(it only make sense if cli is to be upgraded)" orphan:"true"`
CliDownloadingMethod string `name:"cli-download-method" short:"m" brief:"cli upgrade method: http=download binary via HTTP GET, install=upgrade via go install" d:"http"`
// CliModulePath specifies the module path for CLI installation via go install.
// This is used when CliDownloadingMethod is set to "install".
CliModulePath string `name:"cli-module-path" short:"p" brief:"custom cli module path for upgrade CLI tool with go install method" d:"github.com/gogf/gf/cmd/gf/v2@latest"`
}
type cUpOutput struct{}
@@ -76,7 +85,7 @@ func (c cUp) Index(ctx context.Context, in cUpInput) (out *cUpOutput, err error)
}
if in.Cli {
if err = c.doUpgradeCLI(ctx); err != nil {
if err = c.doUpgradeCLI(ctx, in); err != nil {
return nil, err
}
}
@@ -170,8 +179,22 @@ func (c cUp) doUpgradeVersion(ctx context.Context, in cUpInput) (out *doUpgradeV
}
// doUpgradeCLI downloads the new version binary with process.
func (c cUp) doUpgradeCLI(ctx context.Context) (err error) {
func (c cUp) doUpgradeCLI(ctx context.Context, in cUpInput) (err error) {
mlog.Print(`start upgrading cli...`)
fmt.Println(` cli upgrade method:`, in.CliDownloadingMethod)
switch in.CliDownloadingMethod {
case cliMethodHttpDownload:
return c.doUpgradeCLIWithHttpDownload(ctx)
case cliMethodGoInstall:
return c.doUpgradeCLIWithGoInstall(ctx, in)
default:
mlog.Fatalf(`invalid cli upgrade method: "%s", please use "http" or "install"`, in.CliDownloadingMethod)
}
return
}
func (c cUp) doUpgradeCLIWithHttpDownload(ctx context.Context) (err error) {
mlog.Print(`start upgrading cli with http get download...`)
var (
downloadUrl = fmt.Sprintf(
`https://github.com/gogf/gf/releases/latest/download/gf_%s_%s`,
@@ -213,6 +236,41 @@ func (c cUp) doUpgradeCLI(ctx context.Context) (err error) {
return
}
func (c cUp) doUpgradeCLIWithGoInstall(ctx context.Context, in cUpInput) (err error) {
mlog.Print(`upgrading cli with go install...`)
if !genv.Contains("GOPATH") {
mlog.Fatal(`"GOPATH" environment variable does not exist, please check your go installation`)
}
command := fmt.Sprintf(`go install %s`, in.CliModulePath)
mlog.Printf(`running command: %s`, command)
err = gproc.ShellRun(ctx, command)
if err != nil {
return err
}
cliFilePath := gfile.Join(genv.Get("GOPATH").String(), "bin/gf")
if runtime.GOOS == "windows" {
cliFilePath += ".exe"
}
// It fails if file not exist or its size is less than 1MB.
if !gfile.Exists(cliFilePath) || gfile.Size(cliFilePath) < 1024*1024 {
mlog.Fatalf(`go install %s failed, "%s" does not exist or its size is less than 1MB`, in.CliModulePath, cliFilePath)
}
newFile, err := gfile.Open(cliFilePath)
if err != nil {
return err
}
// selfupdate
err = selfupdate.Apply(newFile, selfupdate.Options{})
if err != nil {
return err
}
return
}
func (c cUp) doAutoFixing(ctx context.Context, dirPath string, version string) (err error) {
mlog.Printf(`auto fixing directory path "%s" from version "%s" ...`, dirPath, version)
command := fmt.Sprintf(`gf fix -p %s`, dirPath)

View File

@@ -15,6 +15,7 @@ import (
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv"
"github.com/gogf/gf/v2/util/gtag"
"hotgo/internal/library/hggen/internal/utility/mlog"
)

View File

@@ -11,6 +11,9 @@ import (
"fmt"
"strings"
"github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter/renderer"
"github.com/olekukonko/tablewriter/tw"
"golang.org/x/mod/modfile"
"github.com/gogf/gf/v2/container/garray"
@@ -44,8 +47,10 @@ type (
JsonCase string `name:"jsonCase" short:"j" brief:"{CGenDaoBriefJsonCase}" d:"CamelLower"`
ImportPrefix string `name:"importPrefix" short:"i" brief:"{CGenDaoBriefImportPrefix}"`
DaoPath string `name:"daoPath" short:"d" brief:"{CGenDaoBriefDaoPath}" d:"dao"`
TablePath string `name:"tablePath" short:"tp" brief:"{CGenDaoBriefTablePath}" d:"table"`
DoPath string `name:"doPath" short:"o" brief:"{CGenDaoBriefDoPath}" d:"model/do"`
EntityPath string `name:"entityPath" short:"e" brief:"{CGenDaoBriefEntityPath}" d:"model/entity"`
TplDaoTablePath string `name:"tplDaoTablePath" short:"t0" brief:"{CGenDaoBriefTplDaoTablePath}"`
TplDaoIndexPath string `name:"tplDaoIndexPath" short:"t1" brief:"{CGenDaoBriefTplDaoIndexPath}"`
TplDaoInternalPath string `name:"tplDaoInternalPath" short:"t2" brief:"{CGenDaoBriefTplDaoInternalPath}"`
TplDaoDoPath string `name:"tplDaoDoPath" short:"t3" brief:"{CGenDaoBriefTplDaoDoPathPath}"`
@@ -58,6 +63,7 @@ type (
NoJsonTag bool `name:"noJsonTag" short:"k" brief:"{CGenDaoBriefNoJsonTag}" orphan:"true"`
NoModelComment bool `name:"noModelComment" short:"m" brief:"{CGenDaoBriefNoModelComment}" orphan:"true"`
Clear bool `name:"clear" short:"a" brief:"{CGenDaoBriefClear}" orphan:"true"`
GenTable bool `name:"genTable" short:"gt" brief:"{CGenDaoBriefGenTable}" orphan:"true"`
TypeMapping map[DBFieldTypeName]CustomAttributeType `name:"typeMapping" short:"y" brief:"{CGenDaoBriefTypeMapping}" orphan:"true"`
FieldMapping map[DBTableFieldName]CustomAttributeType `name:"fieldMapping" short:"fm" brief:"{CGenDaoBriefFieldMapping}" orphan:"true"`
@@ -99,6 +105,20 @@ var (
Type: "float64",
},
}
// tablewriter Options
twRenderer = tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
Borders: tw.Border{Top: tw.Off, Bottom: tw.Off, Left: tw.Off, Right: tw.Off},
Settings: tw.Settings{
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.Off},
},
Symbols: tw.NewSymbols(tw.StyleASCII),
}))
twConfig = tablewriter.WithConfig(tablewriter.Config{
Row: tw.CellConfig{
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNone},
},
})
)
func (c CGenDao) Dao(ctx context.Context, in CGenDaoInput) (out *CGenDaoOutput, err error) {
@@ -127,7 +147,7 @@ func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) {
if in.genItems == nil {
in.genItems = newCGenDaoInternalGenItems()
}
var (
err error
db gdb.DB
@@ -177,8 +197,29 @@ func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) {
// Table excluding.
if in.TablesEx != "" {
array := garray.NewStrArrayFrom(tableNames)
for _, v := range gstr.SplitAndTrim(in.TablesEx, ",") {
array.RemoveValue(v)
for _, p := range gstr.SplitAndTrim(in.TablesEx, ",") {
if gstr.Contains(p, "*") || gstr.Contains(p, "?") {
p = gstr.ReplaceByMap(p, map[string]string{
"\r": "",
"\n": "",
})
p = gstr.ReplaceByMap(p, map[string]string{
"*": "\r",
"?": "\n",
})
p = gregex.Quote(p)
p = gstr.ReplaceByMap(p, map[string]string{
"\r": ".*",
"\n": ".",
})
for _, v := range array.Clone().Slice() {
if gregex.IsMatchString(p, v) {
array.RemoveValue(v)
}
}
} else {
array.RemoveValue(p)
}
}
tableNames = array.Slice()
}
@@ -223,14 +264,18 @@ func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) {
tableNames[i] = ""
continue
}
shardingNewTableSet.Add(newTableName)
// Add prefix to sharding table name, if not, the isSharding check would not match.
shardingNewTableSet.Add(in.Prefix + newTableName)
}
}
newTableName = in.Prefix + newTableName
newTableNames[i] = newTableName
if tableNames[i] != "" {
// If shardingNewTableSet contains newTableName (tableName is empty), it should not be added to tableNames, make it empty and filter later.
newTableNames[i] = newTableName
}
}
tableNames = garray.NewStrArrayFrom(tableNames).FilterEmpty().Slice()
newTableNames = garray.NewStrArrayFrom(newTableNames).FilterEmpty().Slice() // Filter empty table names. make sure that newTableNames and tableNames have the same length.
in.genItems.Scale()
// Dao: index and internal.
@@ -241,6 +286,14 @@ func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) {
NewTableNames: newTableNames,
ShardingTableSet: shardingNewTableSet,
})
// Table: table fields.
generateTable(ctx, CGenDaoInternalInput{
CGenDaoInput: in,
DB: db,
TableNames: tableNames,
NewTableNames: newTableNames,
ShardingTableSet: shardingNewTableSet,
})
// Do.
generateDo(ctx, CGenDaoInternalInput{
CGenDaoInput: in,

View File

@@ -127,6 +127,7 @@ func generateDaoIndex(in generateDaoIndexInput) {
tplView.ClearAssigns()
tplView.Assigns(gview.Params{
tplVarTableSharding: in.IsSharding,
tplVarTableShardingPrefix: in.NewTableName + "_",
tplVarImportPrefix: in.ImportPrefix,
tplVarTableName: in.TableName,
tplVarTableNameCamelCase: in.TableNameCamelCase,
@@ -210,13 +211,9 @@ func generateColumnNamesForDao(fieldMap map[string]*gdb.TableField, removeFieldP
fmt.Sprintf(` #"%s",`, field.Name),
}
}
tw := tablewriter.NewWriter(buffer)
tw.SetBorder(false)
tw.SetRowLine(false)
tw.SetAutoWrapText(false)
tw.SetColumnSeparator("")
tw.AppendBulk(array)
tw.Render()
table := tablewriter.NewTable(buffer, twRenderer, twConfig)
table.Bulk(array)
table.Render()
namesContent := buffer.String()
// Let's do this hack of table writer for indent!
namesContent = gstr.Replace(namesContent, " #", "")
@@ -251,13 +248,9 @@ func generateColumnDefinitionForDao(fieldMap map[string]*gdb.TableField, removeF
" #" + fmt.Sprintf(`// %s`, comment),
}
}
tw := tablewriter.NewWriter(buffer)
tw.SetBorder(false)
tw.SetRowLine(false)
tw.SetAutoWrapText(false)
tw.SetColumnSeparator("")
tw.AppendBulk(array)
tw.Render()
table := tablewriter.NewTable(buffer, twRenderer, twConfig)
table.Bulk(array)
table.Render()
defineContent := buffer.String()
// Let's do this hack of table writer for indent!
defineContent = gstr.Replace(defineContent, " #", "")

View File

@@ -45,14 +45,14 @@ func generateDo(ctx context.Context, in CGenDaoInternalInput) {
IsDo: true,
})
)
// replace all types to interface{}.
// replace all types to any.
structDefinition, _ = gregex.ReplaceStringFuncMatch(
"([A-Z]\\w*?)\\s+([\\w\\*\\.]+?)\\s+(//)",
structDefinition,
func(match []string) string {
// If the type is already a pointer/slice/map, it does nothing.
if !gstr.HasPrefix(match[2], "*") && !gstr.HasPrefix(match[2], "[]") && !gstr.HasPrefix(match[2], "map") {
return fmt.Sprintf(`%s interface{} %s`, match[1], match[3])
return fmt.Sprintf(`%s any %s`, match[1], match[3])
}
return match[0]
},

View File

@@ -41,28 +41,55 @@ func generateStructDefinition(ctx context.Context, in generateStructDefinitionIn
appendImports = append(appendImports, imports)
}
}
tw := tablewriter.NewWriter(buffer)
tw.SetBorder(false)
tw.SetRowLine(false)
tw.SetAutoWrapText(false)
tw.SetColumnSeparator("")
tw.AppendBulk(array)
tw.Render()
table := tablewriter.NewTable(buffer, twRenderer, twConfig)
table.Bulk(array)
table.Render()
stContent := buffer.String()
// Let's do this hack of table writer for indent!
stContent = gstr.Replace(stContent, " #", "")
stContent = gstr.Replace(stContent, "` ", "`")
stContent = gstr.Replace(stContent, "``", "")
buffer.Reset()
buffer.WriteString(fmt.Sprintf("type %s struct {\n", in.StructName))
fmt.Fprintf(buffer, "type %s struct {\n", in.StructName)
if in.IsDo {
buffer.WriteString(fmt.Sprintf("g.Meta `orm:\"table:%s, do:true\"`\n", in.TableName))
fmt.Fprintf(buffer, "g.Meta `orm:\"table:%s, do:true\"`\n", in.TableName)
}
buffer.WriteString(stContent)
buffer.WriteString("}")
return buffer.String(), appendImports
}
func getTypeMappingInfo(
ctx context.Context, fieldType string, inTypeMapping map[DBFieldTypeName]CustomAttributeType,
) (typeNameStr, importStr string) {
if typeMapping, ok := inTypeMapping[strings.ToLower(fieldType)]; ok {
typeNameStr = typeMapping.Type
importStr = typeMapping.Import
return
}
tryTypeMatch, _ := gregex.MatchString(`(.+?)\(([^\(\)]+)\)([\s\)]*)`, fieldType)
var (
tryTypeName string
moreTry bool
)
if len(tryTypeMatch) == 4 {
tryTypeMatch3, _ := gregex.ReplaceString(`\s+`, "", tryTypeMatch[3])
tryTypeName = gstr.Trim(tryTypeMatch[1]) + tryTypeMatch3
moreTry = tryTypeMatch3 != ""
} else {
tryTypeName = gstr.Split(fieldType, " ")[0]
}
if tryTypeName != "" {
if typeMapping, ok := inTypeMapping[strings.ToLower(tryTypeName)]; ok {
typeNameStr = typeMapping.Type
importStr = typeMapping.Import
} else if moreTry {
typeNameStr, importStr = getTypeMappingInfo(ctx, tryTypeName, inTypeMapping)
}
}
return
}
// generateStructFieldDefinition generates and returns the attribute definition for specified field.
func generateStructFieldDefinition(
ctx context.Context, field *gdb.TableField, in generateStructDefinitionInput,
@@ -75,21 +102,7 @@ func generateStructFieldDefinition(
)
if in.TypeMapping != nil && len(in.TypeMapping) > 0 {
var (
tryTypeName string
)
tryTypeMatch, _ := gregex.MatchString(`(.+?)\((.+)\)`, field.Type)
if len(tryTypeMatch) == 3 {
tryTypeName = gstr.Trim(tryTypeMatch[1])
} else {
tryTypeName = gstr.Split(field.Type, " ")[0]
}
if tryTypeName != "" {
if typeMapping, ok := in.TypeMapping[strings.ToLower(tryTypeName)]; ok {
localTypeNameStr = typeMapping.Type
appendImport = typeMapping.Import
}
}
localTypeNameStr, appendImport = getTypeMappingInfo(ctx, field.Type, in.TypeMapping)
}
if localTypeNameStr == "" {

View File

@@ -0,0 +1,147 @@
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gendao
import (
"bytes"
"context"
"path/filepath"
"sort"
"strconv"
"strings"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/gview"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/library/hggen/internal/consts"
"hotgo/internal/library/hggen/internal/utility/mlog"
"hotgo/internal/library/hggen/internal/utility/utils"
)
// generateTable generates dao files for given tables.
func generateTable(ctx context.Context, in CGenDaoInternalInput) {
dirPathTable := gfile.Join(in.Path, in.TablePath)
if !in.GenTable {
if gfile.Exists(dirPathTable) {
in.genItems.AppendDirPath(dirPathTable)
}
return
}
in.genItems.AppendDirPath(dirPathTable)
for i := 0; i < len(in.TableNames); i++ {
var (
realTableName = in.TableNames[i]
newTableName = in.NewTableNames[i]
)
generateTableSingle(ctx, generateTableSingleInput{
CGenDaoInternalInput: in,
TableName: realTableName,
NewTableName: newTableName,
DirPathTable: dirPathTable,
})
}
}
// generateTableSingleInput is the input parameter for generateTableSingle.
type generateTableSingleInput struct {
CGenDaoInternalInput
// TableName specifies the table name of the table.
TableName string
// NewTableName specifies the prefix-stripped or custom edited name of the table.
NewTableName string
DirPathTable string
}
// generateTableSingle generates dao files for a single table.
func generateTableSingle(ctx context.Context, in generateTableSingleInput) {
// Generating table data preparing.
fieldMap, err := in.DB.TableFields(ctx, in.TableName)
if err != nil {
mlog.Fatalf(`fetching tables fields failed for table "%s": %+v`, in.TableName, err)
}
tableNameSnakeCase := gstr.CaseSnake(in.NewTableName)
fileName := gstr.Trim(tableNameSnakeCase, "-_.")
if len(fileName) > 5 && fileName[len(fileName)-5:] == "_test" {
// Add suffix to avoid the table name which contains "_test",
// which would make the go file a testing file.
fileName += "_table"
}
path := filepath.FromSlash(gfile.Join(in.DirPathTable, fileName+".go"))
in.genItems.AppendGeneratedFilePath(path)
if in.OverwriteDao || !gfile.Exists(path) {
var (
ctx = context.Background()
tplContent = getTemplateFromPathOrDefault(
in.TplDaoTablePath, consts.TemplateGenTableContent,
)
)
tplView.ClearAssigns()
tplView.Assigns(gview.Params{
tplVarGroupName: in.Group,
tplVarTableName: in.TableName,
tplVarTableNameCamelCase: formatFieldName(in.NewTableName, FieldNameCaseCamel),
tplVarPackageName: filepath.Base(in.TablePath),
tplVarTableFields: generateTableFields(fieldMap),
})
indexContent, err := tplView.ParseContent(ctx, tplContent)
if err != nil {
mlog.Fatalf("parsing template content failed: %v", err)
}
if err = gfile.PutContents(path, strings.TrimSpace(indexContent)); err != nil {
mlog.Fatalf("writing content to '%s' failed: %v", path, err)
} else {
utils.GoFmt(path)
mlog.Print("generated:", gfile.RealPath(path))
}
}
}
// generateTableFields generates and returns the field definition content for specified table.
func generateTableFields(fields map[string]*gdb.TableField) string {
var buf bytes.Buffer
fieldNames := make([]string, 0, len(fields))
for fieldName := range fields {
fieldNames = append(fieldNames, fieldName)
}
sort.Slice(fieldNames, func(i, j int) bool {
return fields[fieldNames[i]].Index < fields[fieldNames[j]].Index // asc
})
for index, fieldName := range fieldNames {
field := fields[fieldName]
buf.WriteString(" " + strconv.Quote(field.Name) + ": {\n")
buf.WriteString(" Index: " + gconv.String(field.Index) + ",\n")
buf.WriteString(" Name: " + strconv.Quote(field.Name) + ",\n")
buf.WriteString(" Type: " + strconv.Quote(field.Type) + ",\n")
buf.WriteString(" Null: " + gconv.String(field.Null) + ",\n")
buf.WriteString(" Key: " + strconv.Quote(field.Key) + ",\n")
buf.WriteString(" Default: " + generateDefaultValue(field.Default) + ",\n")
buf.WriteString(" Extra: " + strconv.Quote(field.Extra) + ",\n")
buf.WriteString(" Comment: " + strconv.Quote(field.Comment) + ",\n")
buf.WriteString(" },")
if index != len(fieldNames)-1 {
buf.WriteString("\n")
}
}
return buf.String()
}
// generateDefaultValue generates and returns the default value definition for specified field.
func generateDefaultValue(value interface{}) string {
if value == nil {
return "nil"
}
switch v := value.(type) {
case string:
return strconv.Quote(v)
default:
return gconv.String(v)
}
}

View File

@@ -60,6 +60,7 @@ CONFIGURATION SUPPORT
CGenDaoBriefGJsonSupport = `use gJsonSupport to use *gjson.Json instead of string for generated json fields of tables`
CGenDaoBriefImportPrefix = `custom import prefix for generated go files`
CGenDaoBriefDaoPath = `directory path for storing generated dao files under path`
CGenDaoBriefTablePath = `directory path for storing generated table files under path`
CGenDaoBriefDoPath = `directory path for storing generated do files under path`
CGenDaoBriefEntityPath = `directory path for storing generated entity files under path`
CGenDaoBriefOverwriteDao = `overwrite all dao files both inside/outside internal folder`
@@ -69,6 +70,7 @@ CONFIGURATION SUPPORT
CGenDaoBriefNoJsonTag = `no json tag will be added for each field`
CGenDaoBriefNoModelComment = `no model comment will be added for each field`
CGenDaoBriefClear = `delete all generated go files that do not exist in database`
CGenDaoBriefGenTable = `generate table files`
CGenDaoBriefTypeMapping = `custom local type mapping for generated struct attributes relevant to fields of table`
CGenDaoBriefFieldMapping = `custom local type mapping for generated struct attributes relevant to specific fields of table`
CGenDaoBriefShardingPattern = `sharding pattern for table name, e.g. "users_?" will be replace tables "users_001,users_002,..." to "users" dao`
@@ -97,6 +99,8 @@ generated json tag case for model struct, cases are as follows:
tplVarTableNameCamelCase = `TplTableNameCamelCase`
tplVarTableNameCamelLowerCase = `TplTableNameCamelLowerCase`
tplVarTableSharding = `TplTableSharding`
tplVarTableShardingPrefix = `TplTableShardingPrefix`
tplVarTableFields = `TplTableFields`
tplVarPackageImports = `TplPackageImports`
tplVarImportPrefix = `TplImportPrefix`
tplVarStructDefine = `TplStructDefine`
@@ -125,6 +129,7 @@ func init() {
`CGenDaoBriefStdTime`: CGenDaoBriefStdTime,
`CGenDaoBriefWithTime`: CGenDaoBriefWithTime,
`CGenDaoBriefDaoPath`: CGenDaoBriefDaoPath,
`CGenDaoBriefTablePath`: CGenDaoBriefTablePath,
`CGenDaoBriefDoPath`: CGenDaoBriefDoPath,
`CGenDaoBriefEntityPath`: CGenDaoBriefEntityPath,
`CGenDaoBriefGJsonSupport`: CGenDaoBriefGJsonSupport,
@@ -136,6 +141,7 @@ func init() {
`CGenDaoBriefNoJsonTag`: CGenDaoBriefNoJsonTag,
`CGenDaoBriefNoModelComment`: CGenDaoBriefNoModelComment,
`CGenDaoBriefClear`: CGenDaoBriefClear,
`CGenDaoBriefGenTable`: CGenDaoBriefGenTable,
`CGenDaoBriefTypeMapping`: CGenDaoBriefTypeMapping,
`CGenDaoBriefFieldMapping`: CGenDaoBriefFieldMapping,
`CGenDaoBriefShardingPattern`: CGenDaoBriefShardingPattern,

View File

@@ -113,12 +113,12 @@ func (p *EnumsParser) ParsePackage(pkg *packages.Package) {
}
func (p *EnumsParser) Export() string {
var typeEnumMap = make(map[string][]interface{})
var typeEnumMap = make(map[string][]any)
for _, enum := range p.enums {
if typeEnumMap[enum.Type] == nil {
typeEnumMap[enum.Type] = make([]interface{}, 0)
typeEnumMap[enum.Type] = make([]any, 0)
}
var value interface{}
var value any
switch enum.Kind {
case constant.Int:
value = gconv.Int64(enum.Value)

View File

@@ -109,7 +109,7 @@ func (c CGenPb) tagCommentIntoListMap(comment string, lineTagMap *gmap.ListMap)
func (c CGenPb) listMapToStructTag(lineTagMap *gmap.ListMap) string {
var tag string
lineTagMap.Iterator(func(key, value interface{}) bool {
lineTagMap.Iterator(func(key, value any) bool {
if tag != "" {
tag += " "
}

View File

@@ -15,6 +15,8 @@ import (
"strings"
"github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter/renderer"
"github.com/olekukonko/tablewriter/tw"
"github.com/gogf/gf/v2/container/garray"
"github.com/gogf/gf/v2/container/gset"
@@ -37,18 +39,19 @@ type (
CGenPbEntity struct{}
CGenPbEntityInput struct {
g.Meta `name:"pbentity" config:"{CGenPbEntityConfig}" brief:"{CGenPbEntityBrief}" eg:"{CGenPbEntityEg}" ad:"{CGenPbEntityAd}"`
Path string `name:"path" short:"p" brief:"{CGenPbEntityBriefPath}" d:"manifest/protobuf/pbentity"`
Package string `name:"package" short:"k" brief:"{CGenPbEntityBriefPackage}"`
GoPackage string `name:"goPackage" short:"g" brief:"{CGenPbEntityBriefGoPackage}"`
Link string `name:"link" short:"l" brief:"{CGenPbEntityBriefLink}"`
Tables string `name:"tables" short:"t" brief:"{CGenPbEntityBriefTables}"`
Prefix string `name:"prefix" short:"f" brief:"{CGenPbEntityBriefPrefix}"`
RemovePrefix string `name:"removePrefix" short:"r" brief:"{CGenPbEntityBriefRemovePrefix}"`
RemoveFieldPrefix string `name:"removeFieldPrefix" short:"rf" brief:"{CGenPbEntityBriefRemoveFieldPrefix}"`
TablesEx string `name:"tablesEx" short:"x" brief:"{CGenDaoBriefTablesEx}"`
NameCase string `name:"nameCase" short:"n" brief:"{CGenPbEntityBriefNameCase}" d:"Camel"`
JsonCase string `name:"jsonCase" short:"j" brief:"{CGenPbEntityBriefJsonCase}" d:"none"`
Option string `name:"option" short:"o" brief:"{CGenPbEntityBriefOption}"`
Path string `name:"path" short:"p" brief:"{CGenPbEntityBriefPath}" d:"manifest/protobuf/pbentity"`
Package string `name:"package" short:"k" brief:"{CGenPbEntityBriefPackage}"`
GoPackage string `name:"goPackage" short:"g" brief:"{CGenPbEntityBriefGoPackage}"`
Link string `name:"link" short:"l" brief:"{CGenPbEntityBriefLink}"`
Tables string `name:"tables" short:"t" brief:"{CGenPbEntityBriefTables}"`
Prefix string `name:"prefix" short:"f" brief:"{CGenPbEntityBriefPrefix}"`
RemovePrefix string `name:"removePrefix" short:"r" brief:"{CGenPbEntityBriefRemovePrefix}"`
RemoveFieldPrefix string `name:"removeFieldPrefix" short:"rf" brief:"{CGenPbEntityBriefRemoveFieldPrefix}"`
TablesEx string `name:"tablesEx" short:"x" brief:"{CGenDaoBriefTablesEx}"`
NameCase string `name:"nameCase" short:"n" brief:"{CGenPbEntityBriefNameCase}" d:"Camel"`
JsonCase string `name:"jsonCase" short:"j" brief:"{CGenPbEntityBriefJsonCase}" d:"none"`
Option string `name:"option" short:"o" brief:"{CGenPbEntityBriefOption}"`
ShardingPattern []string `name:"shardingPattern" short:"sp" brief:"{CGenDaoBriefShardingPattern}"`
TypeMapping map[DBFieldTypeName]CustomAttributeType `name:"typeMapping" short:"y" brief:"{CGenPbEntityBriefTypeMapping}" orphan:"true"`
FieldMapping map[DBTableFieldName]CustomAttributeType `name:"fieldMapping" short:"fm" brief:"{CGenPbEntityBriefFieldMapping}" orphan:"true"`
@@ -122,6 +125,7 @@ CONFIGURATION SUPPORT
CGenPbEntityBriefTablesEx = `generate all models exclude the specified tables, multiple prefix separated with ','`
CGenPbEntityBriefRemoveFieldPrefix = `remove specified prefix of the field, multiple prefix separated with ','`
CGenPbEntityBriefOption = `extra protobuf options`
CGenPbEntityBriefShardingPattern = `sharding pattern for table name, e.g. "users_?" will replace tables "users_001,users_002,..." to "users" pbentity`
CGenPbEntityBriefGroup = `
specifying the configuration group name of database for generated ORM instance,
it's not necessary and the default value is "default"
@@ -252,6 +256,7 @@ func init() {
`CGenPbEntityBriefNameCase`: CGenPbEntityBriefNameCase,
`CGenPbEntityBriefJsonCase`: CGenPbEntityBriefJsonCase,
`CGenPbEntityBriefOption`: CGenPbEntityBriefOption,
`CGenPbEntityBriefShardingPattern`: CGenPbEntityBriefShardingPattern,
`CGenPbEntityBriefTypeMapping`: CGenPbEntityBriefTypeMapping,
`CGenPbEntityBriefFieldMapping`: CGenPbEntityBriefFieldMapping,
})
@@ -321,6 +326,7 @@ func doGenPbEntityForArray(ctx context.Context, index int, in CGenPbEntityInput)
}
tableNames := ([]string)(nil)
shardingNewTableSet := gset.NewStrSet()
if in.Tables != "" {
tableNames = gstr.SplitAndTrim(in.Tables, ",")
} else {
@@ -348,6 +354,31 @@ func doGenPbEntityForArray(ctx context.Context, index int, in CGenPbEntityInput)
for _, v := range removePrefixArray {
newTableName = gstr.TrimLeftStr(newTableName, v, 1)
}
var shardingTableName string
if len(in.ShardingPattern) > 0 {
for _, pattern := range in.ShardingPattern {
var (
match []string
regPattern = gstr.Replace(pattern, "?", `(.+)`)
)
match, err = gregex.MatchString(regPattern, newTableName)
if err != nil {
mlog.Fatalf(`invalid sharding pattern "%s": %+v`, pattern, err)
}
if len(match) < 2 {
continue
}
shardingTableName = gstr.Replace(pattern, "?", "")
shardingTableName = gstr.Trim(shardingTableName, `_.-`)
}
}
if shardingTableName != "" {
if shardingNewTableSet.Contains(shardingTableName) {
continue
}
shardingNewTableSet.Add(shardingTableName)
newTableName = shardingTableName
}
generatePbEntityContentFile(ctx, CGenPbEntityInternalInput{
CGenPbEntityInput: in,
DB: db,
@@ -414,13 +445,22 @@ func generateEntityMessageDefinition(entityName string, fieldMap map[string]*gdb
appendImports = append(appendImports, imports)
}
}
tw := tablewriter.NewWriter(buffer)
tw.SetBorder(false)
tw.SetRowLine(false)
tw.SetAutoWrapText(false)
tw.SetColumnSeparator("")
tw.AppendBulk(array)
tw.Render()
table := tablewriter.NewTable(buffer,
tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
Borders: tw.Border{Top: tw.Off, Bottom: tw.Off, Left: tw.On, Right: tw.Off},
Settings: tw.Settings{
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.Off},
},
Symbols: tw.NewSymbolCustom("Proto").WithColumn(" "),
})),
tablewriter.WithConfig(tablewriter.Config{
Row: tw.CellConfig{
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNone},
},
}),
)
table.Bulk(array)
table.Render()
stContent := buffer.String()
// Let's do this hack of table writer for indent!
stContent = regexp.MustCompile(`\s+\n`).ReplaceAllString(gstr.Replace(stContent, " #", ""), "\n")
@@ -441,14 +481,23 @@ func generateMessageFieldForPbEntity(index int, field *gdb.TableField, in CGenPb
err error
ctx = gctx.GetInitCtx()
)
if in.TypeMapping != nil && len(in.TypeMapping) > 0 {
// match typeMapping after local type transform.
// eg: double => string, varchar => string etc.
localTypeName, err = in.DB.CheckLocalTypeForField(ctx, field.Type, nil)
if err != nil {
panic(err)
}
if localTypeName != "" {
if typeMapping, ok := in.TypeMapping[strings.ToLower(string(localTypeName))]; ok {
if typeMappingLocal, localOk := in.TypeMapping[strings.ToLower(string(localTypeName))]; localOk {
localTypeNameStr = typeMappingLocal.Type
appendImport = typeMappingLocal.Import
}
}
// Try match unknown / string localTypeName with db type.
if localTypeName == "" || localTypeName == gdb.LocalTypeString {
formattedFieldType, _ := in.DB.GetFormattedDBTypeNameForField(field.Type)
if typeMapping, ok := in.TypeMapping[strings.ToLower(formattedFieldType)]; ok {
localTypeNameStr = typeMapping.Type
appendImport = typeMapping.Import
}

View File

@@ -23,6 +23,7 @@ import (
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv"
"github.com/gogf/gf/v2/util/gtag"
"hotgo/internal/library/hggen/internal/utility/mlog"
"hotgo/internal/library/hggen/internal/utility/utils"
)

View File

@@ -33,7 +33,7 @@ func (c CGenService) generateType(generatedContent *bytes.Buffer, srcStructFunct
generatedContent.WriteString("type(")
generatedContent.WriteString("\n")
srcStructFunctions.Iterator(func(key, value interface{}) bool {
srcStructFunctions.Iterator(func(key, value any) bool {
var (
funcContents = make([]string, 0)
funcContent string
@@ -71,7 +71,7 @@ func (c CGenService) generateVar(generatedContent *bytes.Buffer, srcStructFuncti
// Generating variable and register definitions.
var variableContent string
srcStructFunctions.Iterator(func(key, value interface{}) bool {
srcStructFunctions.Iterator(func(key, value any) bool {
structName := key.(string)
variableContent += gstr.Trim(gstr.ReplaceByMap(consts.TemplateGenServiceContentVariable, g.MapStrStr{
"{StructName}": structName,
@@ -93,7 +93,7 @@ func (c CGenService) generateVar(generatedContent *bytes.Buffer, srcStructFuncti
// See: const.TemplateGenServiceContentRegister
func (c CGenService) generateFunc(generatedContent *bytes.Buffer, srcStructFunctions *gmap.ListMap) {
// Variable register function definitions.
srcStructFunctions.Iterator(func(key, value interface{}) bool {
srcStructFunctions.Iterator(func(key, value any) bool {
structName := key.(string)
generatedContent.WriteString(gstr.Trim(gstr.ReplaceByMap(consts.TemplateGenServiceContentRegister, g.MapStrStr{
"{StructName}": structName,

View File

@@ -27,7 +27,7 @@ var (
// {{.TplTableNameCamelCase}} is a globally accessible object for table {{.TplTableName}} operations.
{{.TplTableNameCamelCase}} = {{.TplTableNameCamelLowerCase}}Dao{
{{- if .TplTableSharding -}}
internal.New{{.TplTableNameCamelCase}}Dao(userShardingHandler),
internal.New{{.TplTableNameCamelCase}}Dao({{.TplTableNameCamelLowerCase}}ShardingHandler),
{{- else -}}
internal.New{{.TplTableNameCamelCase}}Dao(),
{{- end -}}
@@ -35,13 +35,13 @@ var (
)
{{if .TplTableSharding -}}
// userShardingHandler is the handler for sharding operations.
// {{.TplTableNameCamelLowerCase}}ShardingHandler is the handler for sharding operations.
// You can fill this sharding handler with your custom implementation.
func userShardingHandler(m *gdb.Model) *gdb.Model {
func {{.TplTableNameCamelLowerCase}}ShardingHandler(m *gdb.Model) *gdb.Model {
m = m.Sharding(gdb.ShardingConfig{
Table: gdb.ShardingTableConfig{
Enable: true,
Prefix: "",
Prefix: "{{.TplTableShardingPrefix}}",
// Replace Rule field with your custom sharding rule.
// Or you can use "&gdb.DefaultShardingRule{}" for default sharding rule.
Rule: nil,

View File

@@ -0,0 +1,35 @@
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package consts
const TemplateGenTableContent = `
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package {{.TplPackageName}}
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
)
// {{.TplTableNameCamelCase}} defines the fields of table "{{.TplTableName}}" with their properties.
// This map is used internally by GoFrame ORM to understand table structure.
var {{.TplTableNameCamelCase}} = map[string]*gdb.TableField{
{{.TplTableFields}}
}
// Set{{.TplTableNameCamelCase}}TableFields registers the table fields definition to the database instance.
// db: database instance that implements gdb.DB interface.
// schema: optional schema/namespace name, especially for databases that support schemas.
func Set{{.TplTableNameCamelCase}}TableFields(ctx context.Context, db gdb.DB, schema ...string) error {
return db.GetCore().SetTableFields(ctx, "{{.TplTableName}}", {{.TplTableNameCamelCase}}, schema...)
}
`

View File

@@ -1,7 +0,0 @@
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package packed

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -51,26 +51,26 @@ func SetHeaderPrint(enabled bool) {
}
}
func Print(v ...interface{}) {
func Print(v ...any) {
logger.Print(ctx, v...)
}
func Printf(format string, v ...interface{}) {
func Printf(format string, v ...any) {
logger.Printf(ctx, format, v...)
}
func Fatal(v ...interface{}) {
func Fatal(v ...any) {
logger.Fatal(ctx, v...)
}
func Fatalf(format string, v ...interface{}) {
func Fatalf(format string, v ...any) {
logger.Fatalf(ctx, format, v...)
}
func Debug(v ...interface{}) {
func Debug(v ...any) {
logger.Debug(ctx, v...)
}
func Debugf(format string, v ...interface{}) {
func Debugf(format string, v ...any) {
logger.Debugf(ctx, format, v...)
}

View File

@@ -16,6 +16,7 @@ import (
"github.com/gogf/gf/v2/os/gproc"
"github.com/gogf/gf/v2/text/gregex"
"github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/library/hggen/internal/consts"
"hotgo/internal/library/hggen/internal/utility/mlog"
)

View File

@@ -1,23 +0,0 @@
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package utils_test
import (
"fmt"
"testing"
"github.com/gogf/gf/v2/test/gtest"
"hotgo/internal/library/hggen/internal/utility/utils"
)
func Test_GetModPath(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
goModPath := utils.GetModPath()
fmt.Println(goModPath)
})
}

View File

@@ -8,24 +8,72 @@ package views
import (
"context"
"fmt"
"strings"
"hotgo/internal/consts"
"hotgo/internal/library/hggen/internal/cmd/gendao"
"hotgo/internal/model/input/sysin"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/text/gregex"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/library/hggen/internal/cmd/gendao"
"hotgo/internal/model/input/sysin"
"strings"
)
// DoTableColumns 获取指定表生成字段列表
func DoTableColumns(ctx context.Context, in *sysin.GenCodesColumnListInp, config gendao.CGenDaoInput) (fields []*sysin.GenCodesColumnListModel, err error) {
var (
sql = "select ORDINAL_POSITION as `id`, COLUMN_NAME as `name`, COLUMN_COMMENT as `dc`, DATA_TYPE as `dataType`, COLUMN_TYPE as `sqlType`, CHARACTER_MAXIMUM_LENGTH as `length`, IS_NULLABLE as `isAllowNull`, COLUMN_DEFAULT as `defaultValue`, COLUMN_KEY as `index`, EXTRA as `extra` from information_schema.COLUMNS where TABLE_SCHEMA = '%s' and TABLE_NAME = '%s' ORDER BY `id` ASC"
sql string
conf = g.DB(in.Name).GetConfig()
)
err = g.DB(in.Name).Ctx(ctx).Raw(fmt.Sprintf(sql, conf.Name, in.Table)).Scan(&fields)
// 根据数据库类型使用不同的SQL
if conf.Type == consts.DBPgsql {
// PostgreSQL: 使用pg_catalog查询列详细信息
sql = `
SELECT
a.attnum as id,
a.attname as name,
COALESCE(col_description(a.attrelid, a.attnum), '') as dc,
t.typname as dataType,
CASE
WHEN a.atttypmod > 0 THEN t.typname || '(' || (a.atttypmod - 4) || ')'
ELSE t.typname
END as sqlType,
CASE
WHEN a.atttypmod > 0 THEN a.atttypmod - 4
ELSE NULL
END as length,
CASE WHEN a.attnotnull THEN 'NO' ELSE 'YES' END as isAllowNull,
pg_get_expr(ad.adbin, ad.adrelid) as defaultValue,
CASE
WHEN pk.contype = 'p' THEN 'PRI'
WHEN uk.contype = 'u' THEN 'UNI'
ELSE ''
END as "index",
CASE
WHEN ad.adbin IS NOT NULL AND ad.adbin LIKE '%nextval%' THEN 'auto_increment'
ELSE ''
END as extra
FROM pg_attribute a
JOIN pg_class c ON a.attrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
JOIN pg_type t ON a.atttypid = t.oid
LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum
LEFT JOIN pg_constraint pk ON pk.conrelid = c.oid AND pk.contype = 'p' AND a.attnum = ANY(pk.conkey)
LEFT JOIN pg_constraint uk ON uk.conrelid = c.oid AND uk.contype = 'u' AND a.attnum = ANY(uk.conkey)
WHERE n.nspname = 'public'
AND c.relname = '` + in.Table + `'
AND a.attnum > 0
AND NOT a.attisdropped
ORDER BY a.attnum`
} else {
// MySQL: 使用information_schema.COLUMNS
sql = fmt.Sprintf("SELECT ORDINAL_POSITION as id, COLUMN_NAME as name, COLUMN_COMMENT as dc, DATA_TYPE as dataType, COLUMN_TYPE as sqlType, CHARACTER_MAXIMUM_LENGTH as length, IS_NULLABLE as isAllowNull, COLUMN_DEFAULT as defaultValue, COLUMN_KEY as `index`, EXTRA as extra FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s' ORDER BY id ASC", conf.Name, in.Table)
}
err = g.DB(in.Name).Ctx(ctx).Raw(sql).Scan(&fields)
if err != nil {
return nil, err
}

View File

@@ -100,6 +100,7 @@ const (
FormModeInputNumber = "InputNumber" // 数字输入
FormModeInputTextarea = "InputTextarea" // 文本域
FormModeInputEditor = "InputEditor" // 富文本
FormModeInputYaml = "InputYaml" // YAML配置
FormModeInputDynamic = "InputDynamic" // 动态键值对
FormModeDate = "Date" // 日期选择(Y-M-D)
FormModeDateRange = "DateRange" // 日期范围选择
@@ -122,7 +123,7 @@ const (
)
var FormModes = []string{
FormModeInput, FormModeInputNumber, FormModeInputTextarea, FormModeInputEditor, FormModeInputDynamic,
FormModeInput, FormModeInputNumber, FormModeInputTextarea, FormModeInputEditor, FormModeInputYaml, FormModeInputDynamic,
FormModeDate, FormModeDateRange, FormModeTime, FormModeTimeRange,
FormModeRadio, FormModeCheckbox, FormModeSelect, FormModeSelectMultiple, FormModeTreeSelect, FormModeCascader,
FormModeUploadImage, FormModeUploadImages, FormModeUploadFile, FormModeUploadFiles,
@@ -136,6 +137,7 @@ var FormModeMap = map[string]string{
FormModeInputNumber: "数字输入",
FormModeInputTextarea: "文本域",
FormModeInputEditor: "富文本",
FormModeInputYaml: "YAML配置",
FormModeInputDynamic: "动态键值对",
FormModeDate: "日期选择(Y-M-D)",
FormModeDateRange: "日期范围选择",
@@ -173,6 +175,7 @@ const (
FormRoleAccount = "account"
FormRolePassword = "password"
FormRoleAmount = "amount"
FormRoleYaml = "yaml"
)
var FormRoleMap = map[string]string{
@@ -191,6 +194,7 @@ var FormRoleMap = map[string]string{
FormRoleAccount: "账号",
FormRolePassword: "密码",
FormRoleAmount: "金额",
FormRoleYaml: "YAML格式",
}
// 查询条件

View File

@@ -896,9 +896,15 @@ func (l *gCurd) generateSqlContent(ctx context.Context, in *CurdPreviewInput) (e
"menuTable": config.Prefix + "admin_menu",
"mainComponent": "LAYOUT",
}
genFile = new(sysin.GenFile)
genFile = new(sysin.GenFile)
templateName = "source.sql.template"
)
// 根据数据库类型选择不同的模板
if config.Type == consts.DBPgsql {
templateName = "source_pgsql.sql.template"
}
menus, err := service.AdminMenu().GetFastList(ctx)
if err != nil {
return err
@@ -993,7 +999,7 @@ func (l *gCurd) generateSqlContent(ctx context.Context, in *CurdPreviewInput) (e
}
tplData["generatePath"] = genFile.Path
genFile.Content, err = in.view.Parse(ctx, name+".template", tplData)
genFile.Content, err = in.view.Parse(ctx, templateName, tplData)
if err != nil {
return err
}

View File

@@ -9,6 +9,8 @@ import (
"bytes"
"context"
"fmt"
"github.com/olekukonko/tablewriter/renderer"
"github.com/olekukonko/tablewriter/tw"
"strings"
"hotgo/internal/dao"
@@ -30,6 +32,23 @@ const (
InputTypeInsertFields = 6 // 编辑新增过滤字段
InputTypeTreeOptionFields = 7 // 关系树查询字段
EditInpValidatorGenerally = "if err := g.Validator().Rules(\"%s\").Data(in.%s).Messages(\"%s\").Run(ctx); err != nil {\n\t\treturn err.Current()\n\t}\n"
EditInpValidatorYaml = "if err := validate.ValidateYAML(in.%s); err != nil {\n\t\treturn gerror.Newf(\"%s必须为有效的YAML格式: %%s\", err.Error())\n\t}\n"
)
var (
// tablewriter Options
twRenderer = tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
Borders: tw.Border{Top: tw.Off, Bottom: tw.Off, Left: tw.Off, Right: tw.Off},
Settings: tw.Settings{
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.Off},
},
Symbols: tw.NewSymbols(tw.StyleASCII),
}))
twConfig = tablewriter.WithConfig(tablewriter.Config{
Row: tw.CellConfig{
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNone},
},
})
)
func (l *gCurd) inputTplData(ctx context.Context, in *CurdPreviewInput) (data g.Map, err error) {
@@ -67,13 +86,9 @@ func (l *gCurd) generateInputViewColumns(ctx context.Context, in *CurdPreviewInp
}
}
tw := tablewriter.NewWriter(buffer)
tw.SetBorder(false)
tw.SetRowLine(false)
tw.SetAutoWrapText(false)
tw.SetColumnSeparator("")
tw.AppendBulk(array)
tw.Render()
table := tablewriter.NewTable(buffer, twRenderer, twConfig)
table.Bulk(array)
table.Render()
stContent := buffer.String()
// Let's do this hack of table writer for indent!
stContent = gstr.Replace(stContent, " #", "")
@@ -131,13 +146,9 @@ func (l *gCurd) generateInputListColumns(ctx context.Context, in *CurdPreviewInp
}
}
tw := tablewriter.NewWriter(buffer)
tw.SetBorder(false)
tw.SetRowLine(false)
tw.SetAutoWrapText(false)
tw.SetColumnSeparator("")
tw.AppendBulk(array)
tw.Render()
table := tablewriter.NewTable(buffer, twRenderer, twConfig)
table.Bulk(array)
table.Render()
stContent := buffer.String()
// Let's do this hack of table writer for indent!
stContent = gstr.Replace(stContent, " #", "")
@@ -308,6 +319,8 @@ func makeValidatorFunc(field *sysin.GenCodesColumnListModel) (err error, rule st
rule = fmt.Sprintf(EditInpValidatorGenerally, "regex:^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$", field.GoName, field.Dc+"必须包含6-18为字母和数字")
} else if field.FormRole == FormRoleAmount {
rule = fmt.Sprintf(EditInpValidatorGenerally, "regex:(^[0-9]{1,10}$)|(^[0-9]{1,10}[\\\\.]{1}[0-9]{1,2}$)", field.GoName, field.Dc+"最多允许输入10位整数及2位小数")
} else if field.FormRole == FormRoleYaml {
rule = fmt.Sprintf(EditInpValidatorYaml, field.GoName, field.Dc)
} else {
err = gerror.New("not support")
}

View File

@@ -99,10 +99,11 @@ func (l *gCurd) generateLogicSwitchFields(ctx context.Context, in *CurdPreviewIn
func (l *gCurd) generateLogicEdit(ctx context.Context, in *CurdPreviewInput) g.Map {
var (
data = make(g.Map)
updateBuffer = bytes.NewBuffer(nil)
insertBuffer = bytes.NewBuffer(nil)
uniqueBuffer = bytes.NewBuffer(nil)
data = make(g.Map)
updateBuffer = bytes.NewBuffer(nil)
insertBuffer = bytes.NewBuffer(nil)
uniqueBuffer = bytes.NewBuffer(nil)
validationBuffer = bytes.NewBuffer(nil)
)
for _, field := range in.masterFields {
@@ -115,7 +116,12 @@ func (l *gCurd) generateLogicEdit(ctx context.Context, in *CurdPreviewInput) g.M
}
if field.Unique {
uniqueBuffer.WriteString(fmt.Sprintf(LogicEditUnique, field.GoName, in.In.DaoName, in.In.DaoName, field.GoName, field.GoName, field.Dc,in.pk.GoName))
uniqueBuffer.WriteString(fmt.Sprintf(LogicEditUnique, field.GoName, in.In.DaoName, in.In.DaoName, field.GoName, field.GoName, field.Dc, in.pk.GoName))
}
// 添加 YAML 格式验证
if field.IsEdit && field.FormRole == FormRoleYaml {
validationBuffer.WriteString(fmt.Sprintf(EditInpValidatorYaml, field.GoName, field.Dc))
}
}
@@ -130,6 +136,7 @@ func (l *gCurd) generateLogicEdit(ctx context.Context, in *CurdPreviewInput) g.M
data["update"] = updateBuffer.String()
data["insert"] = insertBuffer.String()
data["unique"] = uniqueBuffer.String()
data["validation"] = validationBuffer.String()
return data
}
@@ -239,6 +246,8 @@ func (l *gCurd) generateLogicListWhereEach(buffer *bytes.Buffer, in *CurdPreview
if IsNumberType(field.GoType) {
linkMode = `in.` + field.GoName + ` > 0`
} else if field.GoType == GoTypeBool {
linkMode = `true` // bool 类型始终可以查询
} else if field.GoType == GoTypeGTime {
linkMode = `in.` + field.GoName + ` != nil`
} else if field.GoType == GoTypeJson {
@@ -279,12 +288,23 @@ func (l *gCurd) generateLogicListWhereEach(buffer *bytes.Buffer, in *CurdPreview
case WhereModeNotBetween:
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotBetween(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + "[0], in." + field.GoName + "[1])\n\t}"
case WhereModeLike:
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "Like(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}"
fieldValue := "in." + field.GoName
if field.GoType != GoTypeString && field.GoType != GoTypeBytes {
fieldValue = "gconv.String(in." + field.GoName + ")"
}
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "Like(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", " + fieldValue + ")\n\t}"
case WhereModeLikeAll:
val := `"%"+in.` + field.GoName + `+"%"`
if field.GoType != GoTypeString && field.GoType != GoTypeBytes {
val = `"%"+gconv.String(in.` + field.GoName + `)+"%"`
}
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "Like(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", " + val + ")\n\t}"
case WhereModeNotLike:
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotLike(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}"
fieldValue := "in." + field.GoName
if field.GoType != GoTypeString && field.GoType != GoTypeBytes {
fieldValue = "gconv.String(in." + field.GoName + ")"
}
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotLike(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", " + fieldValue + ")\n\t}"
case WhereModeJsonContains:
val := tablePrefix + `"JSON_CONTAINS("+dao.` + daoName + `.Columns().` + columnName + `+",?)", in.` + field.GoName
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "(" + val + ")\n\t}"

View File

@@ -9,6 +9,7 @@ import (
"bytes"
"context"
"fmt"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/text/gstr"
)
@@ -32,7 +33,7 @@ func (l *gCurd) generateWebEditFormItem(ctx context.Context, in *CurdPreviewInpu
}
var (
defaultComponent = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input placeholder=\"请输入%s\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
defaultComponent = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-input\n placeholder=\"请输入%s\"\n v-model:value=\"formValue.%s\"\n />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
component string
)
@@ -45,102 +46,109 @@ func (l *gCurd) generateWebEditFormItem(ctx context.Context, in *CurdPreviewInpu
component = defaultComponent
case FormModeInputNumber:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input-number placeholder=\"请输入%s\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-input-number\n placeholder=\"请输入%s\"\n v-model:value=\"formValue.%s\"\n />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
case FormModeInputTextarea:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input type=\"textarea\" placeholder=\"%s\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-input\n type=\"textarea\"\n placeholder=\"%s\"\n v-model:value=\"formValue.%s\"\n />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
case FormModeInputEditor:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <Editor style=\"height: 450px\" id=\"%s\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <Editor style=\"height: 450px\" id=\"%s\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.TsName)
case FormModeInputYaml:
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <YamlEditor\n ref=\"%sYamlRef\"\n v-model:value=\"formValue.%s\"\n :height=\"400\"\n placeholder=\"请输入%s\"\n validate-on-blur\n show-stats\n prevent-invalid-submit\n @error=\"handleYamlError\"\n @valid=\"handleYamlValid\"\n @validation-change=\"(isValid) => handleYamlValidationChange(isValid, '%s')\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.TsName, field.Dc, field.TsName)
case FormModeInputDynamic:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-dynamic-input\n v-model:value=\"formValue.%s\"\n preset=\"pair\"\n key-placeholder=\"键名\"\n value-placeholder=\"键值\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-dynamic-input\n v-model:value=\"formValue.%s\"\n preset=\"pair\"\n key-placeholder=\"键名\"\n value-placeholder=\"键值\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeDate:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"formValue.%s\" type=\"date\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"formValue.%s\" type=\"date\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
// case FormModeDateRange: // 必须要有两个字段,后面优化下
case FormModeTime:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"formValue.%s\" type=\"datetime\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"formValue.%s\" type=\"datetime\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
// case FormModeTimeRange: // 必须要有两个字段,后面优化下
case FormModeRadio:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-radio-group v-model:value=\"formValue.%s\" name=\"%s\">\n <n-radio-button\n v-for=\"%s in dict.getOptionUnRef('%s')\"\n :key=\"%s.value\"\n :value=\"%s.value\"\n :label=\"%s.label\"\n />\n </n-radio-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.TsName, field.TsName, in.options.dictMap[field.TsName], field.TsName, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-radio-group v-model:value=\"formValue.%s\" name=\"%s\">\n <n-radio-button\n v-for=\"%s in dict.getOptionUnRef('%s')\"\n :key=\"%s.value\"\n :value=\"%s.value\"\n :label=\"%s.label\"\n />\n </n-radio-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.TsName, field.TsName, in.options.dictMap[field.TsName], field.TsName, field.TsName, field.TsName)
case FormModeCheckbox:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-checkbox-group v-model:value=\"formValue.%s\">\n <n-space>\n <n-checkbox\n v-for=\"item in dict.getOptionUnRef('%s')\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n />\n </n-space>\n </n-checkbox-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-checkbox-group v-model:value=\"formValue.%s\">\n <n-space>\n <n-checkbox\n v-for=\"item in dict.getOptionUnRef('%s')\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n />\n </n-space>\n </n-checkbox-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
case FormModeSelect:
if in.options.dictMap[field.TsName] != nil {
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-select v-model:value=\"formValue.%s\" :options=\"dict.getOptionUnRef('%s')\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-select v-model:value=\"formValue.%s\" :options=\"dict.getOptionUnRef('%s')\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
} else {
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-select v-model:value=\"formValue.%s\" options=\"\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-select v-model:value=\"formValue.%s\" options=\"\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
}
case FormModeSelectMultiple:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-select multiple v-model:value=\"formValue.%s\" :options=\"dict.getOptionUnRef('%s')\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-select multiple v-model:value=\"formValue.%s\" :options=\"dict.getOptionUnRef('%s')\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
case FormModeUploadImage:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"1\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"1\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeUploadImages:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"10\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"10\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeUploadFile:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"1\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"1\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeUploadFiles:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"10\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"10\" v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeSwitch:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-switch :unchecked-value=\"2\" :checked-value=\"1\" v-model:value=\"formValue.%s\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-switch\n :unchecked-value=\"2\"\n :checked-value=\"1\"\n v-model:value=\"formValue.%s\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeRate:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-rate allow-half :default-value=\"formValue.%s\" :on-update:value=\"update%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.GoName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <n-rate allow-half :default-value=\"formValue.%s\" :on-update:value=\"update%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.GoName)
case FormModeCitySelector:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <CitySelector v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
component = fmt.Sprintf(" <n-form-item label=\"%s\" path=\"%s\">\n <CitySelector v-model:value=\"formValue.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModePidTreeSelect:
component = fmt.Sprintf(`<n-form-item label="%v" path="pid">
<n-tree-select
:options="treeOption"
v-model:value="formValue.pid"
key-field="%v"
label-field="%v"
clearable
filterable
default-expand-all
show-path
/>
</n-form-item>`, field.Dc, in.pk.TsName, in.options.Tree.TitleField.TsName)
component = fmt.Sprintf(` <n-form-item label="%v" path="pid">
<n-tree-select
:options="treeOption"
v-model:value="formValue.pid"
key-field="%v"
label-field="%v"
clearable
filterable
default-expand-all
show-path
/>
</n-form-item>`, field.Dc, in.pk.TsName, in.options.Tree.TitleField.TsName)
case FormModeTreeSelect:
component = fmt.Sprintf(`<n-form-item label="%v" path="%v">
<n-tree-select
placeholder="请选择%v"
v-model:value="formValue.%v"
:options="[{ label: 'AA', key: 1, children: [{ label: 'BB', key: 2 }] }]"
clearable
filterable
default-expand-all
/>
</n-form-item>`, field.Dc, field.TsName, field.Dc, field.TsName)
component = fmt.Sprintf(` <n-form-item label="%v" path="%v">
<n-tree-select
placeholder="请选择%v"
v-model:value="formValue.%v"
:options="[{ label: 'AA', key: 1, children: [{ label: 'BB', key: 2 }] }]"
clearable
filterable
default-expand-all
/>
</n-form-item>`, field.Dc, field.TsName, field.Dc, field.TsName)
case FormModeCascader:
component = fmt.Sprintf(`<n-form-item label="%v" path="%v">
<n-cascader
placeholder="请选择%v"
v-model:value="formValue.%v"
:options="[{ label: 'AA', value: 1, children: [{ label: 'BB', value: 2 }] }]"
clearable
filterable
/>
</n-form-item>`, field.Dc, field.TsName, field.Dc, field.TsName)
component = fmt.Sprintf(` <n-form-item label="%v" path="%v">
<n-cascader
placeholder="请选择%v"
v-model:value="formValue.%v"
:options="[{ label: 'AA', value: 1, children: [{ label: 'BB', value: 2 }] }]"
clearable
filterable
/>
</n-form-item>`, field.Dc, field.TsName, field.Dc, field.TsName)
default:
component = defaultComponent
}
buffer.WriteString(fmt.Sprintf("<n-gi span=\"%v\">%v</n-gi>\n\n", field.FormGridSpan, component))
buffer.WriteString(fmt.Sprintf("<n-gi span=\"%v\">\n%v\n </n-gi>\n\n", field.FormGridSpan, component))
}
return buffer.String()
}
@@ -150,10 +158,9 @@ func (l *gCurd) generateWebEditScript(ctx context.Context, in *CurdPreviewInput)
data = make(g.Map)
importBuffer = bytes.NewBuffer(nil)
setupBuffer = bytes.NewBuffer(nil)
hasYamlField = false
)
importBuffer.WriteString(" import { ref, computed } from 'vue';\n")
// 导入字典
if in.options.DictOps.Has {
importBuffer.WriteString(" import { useDictStore } from '@/store/modules/dict';\n")
@@ -190,6 +197,11 @@ func (l *gCurd) generateWebEditScript(ctx context.Context, in *CurdPreviewInput)
if !gstr.Contains(importBuffer.String(), `import Editor`) {
importBuffer.WriteString(" import Editor from '@/components/Editor/editor.vue';\n")
}
case FormModeInputYaml:
if !gstr.Contains(importBuffer.String(), `import YamlEditor`) {
importBuffer.WriteString(" import YamlEditor from '@/components/YamlEditor/index.vue';\n")
}
hasYamlField = true
case FormModeUploadImage, FormModeUploadImages:
if !gstr.Contains(importBuffer.String(), `import UploadImage`) {
importBuffer.WriteString(" import UploadImage from '@/components/Upload/uploadImage.vue';\n")
@@ -207,6 +219,13 @@ func (l *gCurd) generateWebEditScript(ctx context.Context, in *CurdPreviewInput)
}
}
// 根据是否有 YAML 字段添加相应的验证逻辑
if hasYamlField {
setupBuffer.WriteString(" const yamlValidationStates = ref(new Map());\n const isFormValid = computed(() => {\n for (const [fieldName, isValid] of yamlValidationStates.value) {\n if (!isValid) return false;\n }\n return true;\n });\n const handleYamlError = (error) => {\n console.error('YAML 验证错误:', error);\n };\n const handleYamlValid = (content) => {\n console.log('YAML 验证通过:', content);\n };\n const handleYamlValidationChange = (isValid, fieldName) => {\n yamlValidationStates.value.set(fieldName, isValid);\n };\n")
} else {
setupBuffer.WriteString(" const isFormValid = ref(true);\n")
}
data["import"] = importBuffer.String()
data["setup"] = setupBuffer.String()
return data

View File

@@ -8,6 +8,7 @@ package views
import (
"bytes"
"context"
"github.com/gogf/gf/v2/frame/g"
)
@@ -17,7 +18,7 @@ func (l *gCurd) webIndexTplData(ctx context.Context, in *CurdPreviewInput) (g.Ma
importBuffer = bytes.NewBuffer(nil)
importVueMethod = []string{"h", "reactive", "ref", "computed"}
importApiMethod = []string{"List"}
importModelMethod = []string{"columns", "schemas"}
importModelMethod = []string{"columns", "schemas", "State"}
importUtilsMethod = []string{"adaTableScrollX"}
importIcons []string
actionWidth int64 = 72
@@ -100,7 +101,6 @@ func (l *gCurd) webIndexTplData(ctx context.Context, in *CurdPreviewInput) (g.Ma
}
// 导入基础包
importBuffer.WriteString(" import " + ImportWebMethod(importVueMethod) + " from 'vue';\n")
importBuffer.WriteString(" import { useDialog, useMessage } from 'naive-ui';\n")
importBuffer.WriteString(" import { BasicTable, TableAction } from '@/components/Table';\n")
importBuffer.WriteString(" import { BasicForm, useForm } from '@/components/Form/index';\n")

Some files were not shown because too many files have changed in this diff Show More