30 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
孟帅
9f1c1ce031 Merge pull request #188 from rxrddd/v2.0
fix:处理分页结构体PerPage的json别名pageSize 无法被验证导致 pageSize传0也能正常访问而导致数据库无分页拉爆…
2025-07-17 12:28:08 +08:00
zjy
dd5b2b660e fix:处理分页结构体PerPage的json别名pageSize 无法被验证导致 pageSize传0也能正常访问而导致数据库无分页拉爆数据库的问题 2025-07-17 12:09:44 +08:00
zjy
207bba186e fix:处理分页结构体PerPage的json别名pageSize 无法被验证导致 pageSize传0也能正常访问而导致数据库无分页拉爆数据库的问题 2025-07-17 12:06:12 +08:00
孟帅
42d5500941 发布v2.17.8版本,更新内容请查看:https://github.com/bufanyun/hotgo/blob/v2.0/docs/guide-zh-CN/start-update-log.md 2025-07-13 18:57:52 +08:00
孟帅
20a9e38fa8 Merge pull request #185 from rxrddd/v2.0
doc: 优化docsify文档体验
2025-07-13 18:42:08 +08:00
zjy
35c6387b4b doc: 优化docsify文档体验
1.调整在docsify下代码块乱掉的问题
2.新增docsify下的go/yaml/vue/json/sql代码高亮插件
3.新增docsify下的mermaid图解析插件
2025-07-13 18:29:28 +08:00
孟帅
17daeb9121 refactor 调整数据库初始数据,替换默认图片资源域名 2025-07-13 17:44:31 +08:00
256 changed files with 10196 additions and 7707 deletions

View File

@@ -1,18 +1,18 @@
# HotGo-V2
<div align="center">
<img width="140px" src="https://bufanyun.cn-bj.ufileos.com/hotgo/logo.sig.png">
<img width="140px" src="https://gmycos.facms.cn/hotgo/logo.sig.png">
<p>
<h1>HotGo V2</h1>
</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.41.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">
@@ -124,8 +124,8 @@
## 交流QQ群
交流群①190966648 <a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=mJafkvme3VNyiQlCFIFNRtY8Xlr7pj9U&jump_from=webapi&authKey=jL10vIESr+vO8wpxwyd6DlChzkrbHpzN9uhAsIHgAinL/Vvd+nvuRyilf2UqUlCy"><img border="0" src="https://bufanyun.cn-bj.ufileos.com/hotgo/group.png" alt="HotGo框架交流1群" title="HotGo框架交流1群"></a>
> <img src="https://bufanyun.cn-bj.ufileos.com/hotgo/hotgo1qun.png" width="400px"/>
交流群①190966648 <a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=mJafkvme3VNyiQlCFIFNRtY8Xlr7pj9U&jump_from=webapi&authKey=jL10vIESr+vO8wpxwyd6DlChzkrbHpzN9uhAsIHgAinL/Vvd+nvuRyilf2UqUlCy"><img border="0" src="https://gmycos.facms.cn/hotgo/group.png" alt="HotGo框架交流1群" title="HotGo框架交流1群"></a>
> <img src="https://gmycos.facms.cn/hotgo/hotgo1qun.png" width="400px"/>
## 商用说明
@@ -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

@@ -14,7 +14,7 @@
1、HotGo 后台进入 开发工具->插件管理->找到创建新插件,根据引导进行创建即可。
```
```shell
创建成功后默认情况下会在以下目录中生成插件文件假设新生成的插件名为hgexample
1. /server/addons/hgexample/ # 插件模块目录
@@ -29,7 +29,7 @@
2、创建插件完毕重启服务端后插件管理中会出现你新创建的插件信息。操作栏有几个按钮在此进行说明
- 安装:会自动执行 server/hgexample/main.go 文件中的Install方法方法中的具体逻辑默认为空可以根据实际情况自行配置。如生成后台菜单、生成插件配置表初始化数据、迁移home页面、web项目文件等。
```
```go
// Install 安装模块
func (m *module) Install(ctx context.Context) (err error) {
// ...
@@ -38,7 +38,7 @@ func (m *module) Install(ctx context.Context) (err error) {
```
- 更新:会自动执行 server/hgexample/main.go 文件中的Upgrade方法方法中的具体逻辑默认为空可以根据实际情况自行配置。
```
```go
// Upgrade 更新模块
func (m *module) Upgrade(ctx context.Context) (err error) {
// ...
@@ -47,7 +47,7 @@ func (m *module) Upgrade(ctx context.Context) (err error) {
```
- 卸载:会自动执行 server/hgexample/main.go 文件中的UnInstall方法方法中的具体逻辑默认为空可以根据实际情况自行配置。如会清除所有的数据表和已安装的信息等。
```
```go
// UnInstall 卸载模块
func (m *module) UnInstall(ctx context.Context) (err error) {
// ...

View File

@@ -9,6 +9,7 @@
#### 模块结构
- 文件路径server/internal/library/addons/module.go
```go
// Skeleton 模块骨架
type Skeleton struct {
@@ -43,6 +44,7 @@ type Module interface {
#### 获取模块信息
- 在插件模块内
```go
package main
@@ -57,6 +59,7 @@ func test() {
```
- 在插件模块外
```go
package main

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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

View File

@@ -78,7 +78,7 @@ pnpm run build 或 npm run build
### Nginx配置
```
# websocket
location ^~ /socket {
location = /socket {
proxy_pass http://127.0.0.1:8000/socket;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -98,7 +98,9 @@ pnpm run build 或 npm run build
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8000/; # 设置代理服务器的协议和地址
proxy_pass http://127.0.0.1:8000/;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;

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)
@@ -69,7 +69,7 @@ gfcli:
三、 启动服务
1、服务端
```shell script
```shell
cd server
# 设置国内代理,如果已经设置好了代理可以跳过
@@ -86,7 +86,7 @@ gfcli:
```
2、web前端
```shell script
```shell
cd web
# 首先确定你以安装node16.0以上版本并安装了包[npm、pnpm],否则可能会出现一些未知报错

View File

@@ -22,7 +22,7 @@
#### 1、安装数据库出现 json 报错不支持
请安装 mysql5.7 及以上版本的数据库
请安装 mysql5.7 及以上版本的数据库。如果你使用的是mariadb请确认版本号mariadb从 10.2 版本开始支持 json 数据类型。
@@ -50,7 +50,31 @@
系统运行目录下配置hack/config.yaml文件。如果是生产环境运行并且不需要开发工具相关功能可以将`manifest/config/config.yaml`配置文件中的`system.mode`值改为`product`,这样启动时不会加载开发工具相关功能
#### 4、非超管角色提示你没有访问权限
![1.4.0.png](./images/issue/1.4.0.png)
此问题因当前角色访问的页面包含未分配权限的接口所致,在多角色场景中较为常见,解决步骤如下:
1. 定位缺失权限的接口
- 用超管账号进入系统应用 -> 日志管理 -> 全局日志,搜索状态码为`62 无访问权限`的记录
- 示例:若请求接口为`/admin/hgexample/treeTable/list`,需处理的权限路径为`/hgexample/treeTable/list`(去除`/admin`前缀)
![1.4.1.png](./images/issue/1.4.1.png)
假如查到请求接口是:`/admin/hgexample/treeTable/list`,那需要分配的菜单权限就是:`/hgexample/treeTable/list`,要把`/admin`去掉
2. 配置菜单权限
- 进入权限管理 -> 菜单权限:
- 若目标菜单不存在,先新增菜单
- 若菜单已存在但未配置接口权限就把步骤1中的权限路径添加到【分配权限】中已配置则跳过
![1.4.2.png](./images/issue/1.4.2.png)
3. 分配权限给角色
- 进入权限管理 -> 角色权限,找到对应角色并点击【菜单权限】
- 勾选步骤2中配置的菜单权限保存即可
![1.4.3.png](./images/issue/1.4.3.png)
### 四、前端相关

View File

@@ -11,6 +11,33 @@
> 如果升级(覆盖)代码后打开会出现 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
- 优化:表格排序处理器兼容关联表别名
- 优化优化动态统计数字在0值时显示问题
- 优化:优化首页快捷菜单点击事件范围
- 优化:优化短信、邮件验证码相关验证类数据排序
- 优化优化Nginx配置支持流式请求和兼容部分版本无法匹配到websocket规则问题
- 优化naive-ui版本升级到2.42.0
- 优化vue3-json-viewer版本升级到2.4.1
- 修复:修复可选用户选项`Fields`生成错误问题
### v2.16.10
updated 2025.3.22

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" # 指定当前数据库中需要排除代码生成的数据表。
@@ -176,7 +177,7 @@ CREATE TABLE `hg_test_category` (
1.3 插入测试数据
```mysql
INSERT INTO `hg_test_table` (`id`, `category_id`, `title`, `description`, `content`, `image`, `attachfile`, `city_id`, `switch`, `sort`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 1, '测试标题', '描述', '<h2><strong>不知道写点啥!</strong></h2><p><br></p><iframe class=\"ql-video\" frameborder=\"0\" allowfullscreen=\"true\" src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\"></iframe><p><br></p><p><img src=\"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdq9iuv0phsg8patk.png\"></p>', 'https://bufanyun.cn-bj.ufileos.com/hotgo/logo.sig.png', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2022-12-30/cpf1x44idoycrtajf2.xlsx', 110102, 1, 10, 1, 0, 1, '2022-12-15 19:30:14', '2023-02-23 13:55:32', NULL);
INSERT INTO `hg_test_table` (`id`, `category_id`, `title`, `description`, `content`, `image`, `attachfile`, `city_id`, `switch`, `sort`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 1, '测试标题', '描述', '<h2><strong>不知道写点啥!</strong></h2><p><br></p><iframe class=\"ql-video\" frameborder=\"0\" allowfullscreen=\"true\" src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\"></iframe><p><br></p><p><img src=\"https://gmycos.facms.cn/hotgo/attachment/2023-02-09/cqdq9iuv0phsg8patk.png\"></p>', 'https://gmycos.facms.cn/hotgo/logo.sig.png', 'https://gmycos.facms.cn/hotgo/attachment/2022-12-30/cpf1x44idoycrtajf2.xlsx', 110102, 1, 10, 1, 0, 1, '2022-12-15 19:30:14', '2023-02-23 13:55:32', NULL);
```
@@ -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

@@ -1,149 +1,150 @@
## 数据库
目录
- 字段类型
- 特殊字段默认表单组件
- 特殊字段默认表单验证器
- SQL默认查询方式
- 其他
### 字段类型
- 创建数据库表当按如下的规则进行字段命名、类型、属性设置和备注后再生成CRUD代码时会自动生成对应的Api、控制器、业务逻辑、Web页面、[表单组件](web-form.md)等的一些默认属性
- 当你了解这些默认技巧后,会有效提高你在实际开发中的生产效率
| 数据库类型 | 额外属性 | 转换Go类型 | 转换Ts类型 | 表单组件 |
|---------------------------------------------------------------|--------------|--------------|---------|-----------------------|
| int, tinyint,small_int,smallint,medium_int,mediumint,serial | / | int | number | InputNumber(数字输入框) |
| int, tinyint,small_int,smallint,medium_int,mediumint,serial | unsigned | uint | number | InputNumber(数字输入框) |
| big_int,bigint,bigserial | / | int64 | number | InputNumber(数字输入框) |
| big_int,bigint,bigserial | unsigned | uint64 | number | InputNumber(数字输入框) |
| real | / | float32 | number | InputNumber(数字输入框) |
| float,double,decimal,money,numeric,smallmoney | / | float64 | number | InputNumber(数字输入框) |
| bit(1) 、bit(true)、bit(false) | / | bool | boolean | Input(文本输入框,默认) |
| bit | / | int64-bytes | array | InputDynamic(动态KV表单) |
| bit | unsigned | uint64-bytes | array | InputDynamic (动态KV表单) |
| bool | / | bool | boolean | Input(文本输入框,默认) |
| date | / | *gtime.Time | string | Date(日期选择器) |
| datetime,timestamp,timestamptz | / | *gtime.Time | string | Time(时间选择器) |
| json | / | *gjson.Json | string | Input(文本输入框) |
| jsonb | / | *gjson.Json | string | Input(文本输入框) |
| 以下为物理类型中包含字段部分时的转换方式,默认情况 | / | / | / | / |
| text,char,character | / | string | string | Input(文本输入框) |
| float,double,numeric | / | string | string | Input(文本输入框) |
| bool | / | bool | boolean | Input(文本输入框,默认) |
| binary,blob | / | []byte | string | Input(文本输入框,默认) |
| int | / | int | number | InputNumber(数字输入框) |
| int | unsigned | int | number | InputNumber(数字输入框) |
| time | / | *gtime.Time | string | Time(时间选择器) |
| date | / | *gtime.Time | string | Date(日期选择器) |
| 没有满足以上任何条件的 | / | string | string | Input(文本输入框) |
### 特殊字段默认表单组件
- 以下字段在不设置表单组件时会默认使用的表单组件
| 数据库字段 | 字段名称 | 表单组件 |
|--------------|----------------------|----------------------|
| status | 状态字段任意int类型 | Select (单选下拉框) |
| created_at | 创建时间字段 | TimeRange (时间范围选择) |
| province_id | 省份ID字段任意int类型 | CitySelector (省市区选择) |
| city_id | 城市ID字段任意int类型 | CitySelector (省市区选择) |
| 任意字串符字段 | 长度>= 200 and <= 500 | InputTextarea (文本域) |
| 任意字串符字段 | 长度> 500 | InputEditor (富文本) |
### 特殊字段默认表单验证器
- 以下字段在不设置表单组件时会默认使用的表单验证器
| 数据库字段/Go类型 | 字段名称 | 表单验证规则 |
|-------------------|--------|-----------------------|
| mobile | 手机号 | 不为空时必须是手机号码(国内) |
| qq | QQ | 不为空时必须是QQ号码 |
| email | 邮箱地址 | 不为空时必须是邮箱格式 |
| id_card | 身份证号码 | 不为空时必须是15或18位身份证号码 |
| bank_card | 银行卡号码 | 银行卡号码 |
| password | 密码 | 密码验证必须包含6-18为字母和数字 |
| price | 价格 | 金额验证最多允许输入10位整数及2位小数 |
| Go类型为uint、uint64 | 正整数 | 非零正整数验证 |
### SQL默认查询方式
- Go类型取决于数据库物理类型请参考 [字段类型] 部分
| Go类型 | 查询方式 |
|-------------------------|--------------------------------------|
| string | LIKE |
| date,datetime | = |
| int,uint,int64,uint64 | = |
| []int,[]int64,[]uint64 | IN (...) |
| float32,float64 | = |
| []byte4 | =(默认) |
| time.Time,*gtime.Time | = |
| *gjson.Json | JSON_CONTAINS(json_doc, val[, path]) |
### 其他
#### 默认字典选项
- 数据库字段为 `status`且类型为任意数字类型的会使用系统默认的状态字典
#### 默认属性
- 默认必填,当数据库字段存在非空`IS_NULLABLE`属性时,默认勾选必填验证
- 默认唯一,当数据库字段索引存在`UNI`时,默认勾选唯一值验证
- 默认主键,当数据库字段索引存在`PRI`时,默认为主键,不允许编辑
- 默认排序,当数据库字段存在`sort`时,默认开启排序,添加表单自动获取最大排序增量值并填充表单
- 默认列名,默认使用字段注释作为表格的列名。当数据库字段未设置注释时,默认使用字段名称作为列名
#### 自动更新/插入
- 自动更新,当数据库字段为`updated_at`(更新时间),`updated_by`(更新者)
- 自动插入,当数据库字段为`created_at`(创建时间),`created_by`(创建者)
- 软删除,表存在字段`deleted_at`使用表的Orm模型查询条件将会自动加入[ `deleted_at` IS NULL ],删除时只更新删除时间而不会真的删除数据
- 树表:不论更新插入,都会根据表中字段`pid`(上级ID)自动维护`level`(树等级)和`tree`(关系树)
#### 操作人字段维护
- 生成列表中存在并且勾选展示字段`created_by`(创建者)、`updated_by`(修改者)、`deleted_by`(删除者)时,会自动到表`hg_admin_member`中获取操作人的基本信息摘要,并渲染到列表中,效果如下:
![](images/sys-db-by.png)
- 生成列表中存在并且勾选查询字段`created_by`(创建者)、`updated_by`(修改者)、`deleted_by`(删除者)时,会强制将查询表单改为关键词查询,从`hg_admin_member`查询操作人。效果如下:
![](images/sys-db-by2.png)
- 查询代码片段,参考路径:[server/internal/logic/admin/member.go](../../server/internal/logic/admin/member.go)
```go
// 查询创建者
if in.CreatedBy != "" {
ids, err := service.AdminMember().GetIdsByKeyword(ctx, in.CreatedBy)
if err != nil {
return nil, 0, err
}
mod = mod.WhereIn(dao.SysGenCurdDemo.Columns().CreatedBy, ids)
}
// GetIdsByKeyword 根据关键词查找符合条件的用户ID
func (s *sAdminMember) GetIdsByKeyword(ctx context.Context, ks string) (res []int64, err error) {
ks = gstr.Trim(ks)
if len(ks) == 0 {
return
}
array, err := dao.AdminMember.Ctx(ctx).Fields("id").
Where("`id` = ? or `real_name` = ? or `username` = ? or `mobile` = ?", ks, ks, ks, ks).
Array()
if err != nil {
err = gerror.Wrap(err, "根据关键词获取用户ID失败请稍后重试")
}
res = gvar.New(array).Int64s()
return
}
```
> 这里只列举了较为常用的默认规则,其他更多默认规则请参考:[server/internal/library/hggen/views/column_default.go](../../server/internal/library/hggen/views/column_default.go)
## 数据库
目录
- 字段类型
- 特殊字段默认表单组件
- 特殊字段默认表单验证器
- SQL默认查询方式
- 其他
### 字段类型
- 创建数据库表当按如下的规则进行字段命名、类型、属性设置和备注后再生成CRUD代码时会自动生成对应的Api、控制器、业务逻辑、Web页面、[表单组件](web-form.md)等的一些默认属性
- 当你了解这些默认技巧后,会有效提高你在实际开发中的生产效率
| 数据库类型 | 额外属性 | 转换Go类型 | 转换Ts类型 | 表单组件 |
|---------------------------------------------------------------|--------------|--------------|---------|-----------------------|
| int, tinyint,small_int,smallint,medium_int,mediumint,serial | / | int | number | InputNumber(数字输入框) |
| int, tinyint,small_int,smallint,medium_int,mediumint,serial | unsigned | uint | number | InputNumber(数字输入框) |
| big_int,bigint,bigserial | / | int64 | number | InputNumber(数字输入框) |
| big_int,bigint,bigserial | unsigned | uint64 | number | InputNumber(数字输入框) |
| real | / | float32 | number | InputNumber(数字输入框) |
| float,double,decimal,money,numeric,smallmoney | / | float64 | number | InputNumber(数字输入框) |
| bit(1) 、bit(true)、bit(false) | / | bool | boolean | Input(文本输入框,默认) |
| bit | / | int64-bytes | array | InputDynamic(动态KV表单) |
| bit | unsigned | uint64-bytes | array | InputDynamic (动态KV表单) |
| bool | / | bool | boolean | Input(文本输入框,默认) |
| date | / | *gtime.Time | string | Date(日期选择器) |
| datetime,timestamp,timestamptz | / | *gtime.Time | string | Time(时间选择器) |
| json | / | *gjson.Json | string | Input(文本输入框) |
| jsonb | / | *gjson.Json | string | Input(文本输入框) |
| 以下为物理类型中包含字段部分时的转换方式,默认情况 | / | / | / | / |
| text,char,character | / | string | string | Input(文本输入框) |
| float,double,numeric | / | string | string | Input(文本输入框) |
| bool | / | bool | boolean | Input(文本输入框,默认) |
| binary,blob | / | []byte | string | Input(文本输入框,默认) |
| int | / | int | number | InputNumber(数字输入框) |
| int | unsigned | int | number | InputNumber(数字输入框) |
| time | / | *gtime.Time | string | Time(时间选择器) |
| date | / | *gtime.Time | string | Date(日期选择器) |
| 没有满足以上任何条件的 | / | string | string | Input(文本输入框) |
### 特殊字段默认表单组件
- 以下字段在不设置表单组件时会默认使用的表单组件
| 数据库字段 | 字段名称 | 表单组件 |
|--------------|----------------------|----------------------|
| status | 状态字段任意int类型 | Select (单选下拉框) |
| created_at | 创建时间字段 | TimeRange (时间范围选择) |
| province_id | 省份ID字段任意int类型 | CitySelector (省市区选择) |
| city_id | 城市ID字段任意int类型 | CitySelector (省市区选择) |
| 任意字串符字段 | 长度>= 200 and <= 500 | InputTextarea (文本域) |
| 任意字串符字段 | 长度> 500 | InputEditor (富文本) |
### 特殊字段默认表单验证器
- 以下字段在不设置表单组件时会默认使用的表单验证器
| 数据库字段/Go类型 | 字段名称 | 表单验证规则 |
|-------------------|--------|-----------------------|
| mobile | 手机号 | 不为空时必须是手机号码(国内) |
| qq | QQ | 不为空时必须是QQ号码 |
| email | 邮箱地址 | 不为空时必须是邮箱格式 |
| id_card | 身份证号码 | 不为空时必须是15或18位身份证号码 |
| bank_card | 银行卡号码 | 银行卡号码 |
| password | 密码 | 密码验证必须包含6-18为字母和数字 |
| price | 价格 | 金额验证最多允许输入10位整数及2位小数 |
| Go类型为uint、uint64 | 正整数 | 非零正整数验证 |
### SQL默认查询方式
- Go类型取决于数据库物理类型请参考 [字段类型] 部分
| Go类型 | 查询方式 |
|-------------------------|--------------------------------------|
| string | LIKE |
| date,datetime | = |
| int,uint,int64,uint64 | = |
| []int,[]int64,[]uint64 | IN (...) |
| float32,float64 | = |
| []byte4 | =(默认) |
| time.Time,*gtime.Time | = |
| *gjson.Json | JSON_CONTAINS(json_doc, val[, path]) |
### 其他
#### 默认字典选项
- 数据库字段为 `status`且类型为任意数字类型的会使用系统默认的状态字典
#### 默认属性
- 默认必填,当数据库字段存在非空`IS_NULLABLE`属性时,默认勾选必填验证
- 默认唯一,当数据库字段索引存在`UNI`时,默认勾选唯一值验证
- 默认主键,当数据库字段索引存在`PRI`时,默认为主键,不允许编辑
- 默认排序,当数据库字段存在`sort`时,默认开启排序,添加表单自动获取最大排序增量值并填充表单
- 默认列名,默认使用字段注释作为表格的列名。当数据库字段未设置注释时,默认使用字段名称作为列名
#### 自动更新/插入
- 自动更新,当数据库字段为`updated_at`(更新时间),`updated_by`(更新者)
- 自动插入,当数据库字段为`created_at`(创建时间),`created_by`(创建者)
- 软删除,表存在字段`deleted_at`使用表的Orm模型查询条件将会自动加入[ `deleted_at` IS NULL ],删除时只更新删除时间而不会真的删除数据
- 树表:不论更新插入,都会根据表中字段`pid`(上级ID)自动维护`level`(树等级)和`tree`(关系树)
#### 操作人字段维护
- 生成列表中存在并且勾选展示字段`created_by`(创建者)、`updated_by`(修改者)、`deleted_by`(删除者)时,会自动到表`hg_admin_member`中获取操作人的基本信息摘要,并渲染到列表中,效果如下:
![](images/sys-db-by.png)
- 生成列表中存在并且勾选查询字段`created_by`(创建者)、`updated_by`(修改者)、`deleted_by`(删除者)时,会强制将查询表单改为关键词查询,从`hg_admin_member`查询操作人。效果如下:
![](images/sys-db-by2.png)
- 查询代码片段,参考路径:[server/internal/logic/admin/member.go](../../server/internal/logic/admin/member.go)
```go
// 查询创建者
if in.CreatedBy != "" {
ids, err := service.AdminMember().GetIdsByKeyword(ctx, in.CreatedBy)
if err != nil {
return nil, 0, err
}
mod = mod.WhereIn(dao.SysGenCurdDemo.Columns().CreatedBy, ids)
}
// GetIdsByKeyword 根据关键词查找符合条件的用户ID
func (s *sAdminMember) GetIdsByKeyword(ctx context.Context, ks string) (res []int64, err error) {
ks = gstr.Trim(ks)
if len(ks) == 0 {
return
}
array, err := dao.AdminMember.Ctx(ctx).Fields("id").
Where("`id` = ? or `real_name` = ? or `username` = ? or `mobile` = ?", ks, ks, ks, ks).
Array()
if err != nil {
err = gerror.Wrap(err, "根据关键词获取用户ID失败请稍后重试")
}
res = gvar.New(array).Int64s()
return
}
```
> 这里只列举了较为常用的默认规则,其他更多默认规则请参考:[server/internal/library/hggen/views/column_default.go](../../server/internal/library/hggen/views/column_default.go)

View File

@@ -63,16 +63,17 @@
#### import
* 单行import不建议用圆括号包裹
* 按照`官方包`NEW LINE`当前工程包`NEW LINE`第三方依赖包`顺序引入
```go
import (
"context"
"string"
"greet/user/internal/config"
"google.golang.org/grpc"
)
```
```go
import (
"context"
"string"
"greet/user/internal/config"
"google.golang.org/grpc"
)
```
#### 函数返回
* 对象避免非指针返回
@@ -84,7 +85,8 @@
#### 函数体编码
* 建议一个block结束空一行如if、for等
```go
```go
func main (){
if x==1{
// do something
@@ -92,15 +94,16 @@
fmt.println("xxx")
}
```
```
* return前尽可能空一行
```go
func getUser(id string)(string,error){
....
return "xx",nil
}
```
```go
func getUser(id string)(string,error){
....
return "xx",nil
}
```
### 框架规范

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

@@ -1,316 +1,318 @@
## 功能扩展库
目录
- 缓存驱动
- 请求上下文
- JWT
- 数据字典
- 地理定位(待写)
- 通知(待写)
### 缓存驱动
> 系统默认的缓存驱动为file目前已支持memory|redis|file等多种驱动。请自行选择适合你的驱动使用。
- 配置文件server/manifest/config/config.yaml
```yaml
#缓存
cache:
adapter: "file" # 缓存驱动方式支持memory|redis|file不填默认memory
fileDir: "./storage/cache" # 文件缓存路径adapter=file时必填
```
#### 使用方式
```go
package main
import (
"hotgo/internal/library/cache"
"github.com/gogf/gf/v2/os/gctx"
)
func test() {
ctx := gctx.New()
// 添加/修改
cache.Instance().Set(ctx, "qwe", 123, 0)
// 查询
cache.Instance().Get(ctx, "qwe")
// 删除
cache.Instance().Remove(ctx, "qwe")
// 更多方法请参考https://goframe.org/pages/viewpage.action?pageId=27755640
}
```
### 请求上下文
- 主要用于在处理HTTP和websocket请求时通过中间件将用户、应用、插件等信息绑定到上下文中方便在做业务处理时用到这些信息
```go
package admin
import (
"fmt"
"context"
"hotgo/internal/library/contexts"
"hotgo/internal/library/addons"
)
func test(ctx context.Context) {
// 获取当前请求的所有上下文变量
var ctxModel = contexts.Get(ctx)
fmt.Printf("当前请求的所有上下文变量:%+v\n", ctxModel)
// 获取当前请求的应用模块
var module = contexts.GetModule(ctx)
fmt.Printf("当前请求的应用:%+v\n", module)
// 获取当前请求的用户信息
var member = contexts.GetUser(ctx)
fmt.Printf("当前访问用户信息:%+v\n", member)
// 获取当前请求的插件模块
fmt.Printf("当前是否为插件请求:%v", contexts.IsAddonRequest(ctx))
if contexts.IsAddonRequest(ctx) {
fmt.Printf("当前插件名称:%v", contexts.GetAddonName(ctx))
fmt.Printf("当前插件信息:%v", addons.GetModule(contexts.GetAddonName(ctx)))
}
}
```
### JWT
- 基于jwt+缓存驱动实现的用户登录令牌功能支持自动续约解决了jwt服务端无法退出问题和jwt令牌无法主动失效问题
#### 配置示例
```yaml
# 登录令牌
token:
secretKey: "hotgo123" # 令牌加密秘钥,考虑安全问题生产环境中请修改默认值
expires: 604800 # 令牌有效期单位秒。默认7天
autoRefresh: true # 是否开启自动刷新过期时间, false|true 默认为true
refreshInterval: 86400 # 刷新间隔单位秒。必须小于expires否则无法触发。默认1天内只允许刷新一次
maxRefreshTimes: 30 # 最大允许刷新次数,-1不限制。默认30次
multiLogin: true # 是否允许多端登录, false|true 默认为true
```
```go
package admin
import (
"fmt"
"context"
"hotgo/internal/library/token"
"hotgo/internal/model"
)
func test(ctx context.Context) {
// 登录
user := &model.Identity{
Id: mb.Id,
Pid: mb.Pid,
DeptId: mb.DeptId,
RoleId: ro.Id,
RoleKey: ro.Key,
Username: mb.Username,
RealName: mb.RealName,
Avatar: mb.Avatar,
Email: mb.Email,
Mobile: mb.Mobile,
App: consts.AppAdmin,
LoginAt: gtime.Now(),
}
loginToken, expires, err := token.Login(ctx, user)
if err != nil {
return nil, err
}
// gf请求对象
r := *ghttp.Request
// 获取登录用户信息
user, err := token.ParseLoginUser(r)
if err != nil {
return
}
// 注销登录
err = token.Logout(r)
}
```
### 数据字典
- hotgo增加了对枚举字典和自定义方法字典的内置支持从而在系统中经常使用的一些特定数据上做出了增强。
#### 字典数据选项
- 文件路径server/internal/model/dict.go
```go
package model
// Option 字典数据选项
type Option struct {
Key interface{} `json:"key"`
Label string `json:"label" description:"字典标签"`
Value interface{} `json:"value" description:"字典键值"`
ValueType string `json:"valueType" description:"键值数据类型"`
Type string `json:"type" description:"字典类型"`
ListClass string `json:"listClass" description:"表格回显样式"`
}
```
#### 枚举字典
- 适用于系统开发期间内置的枚举数据,这样即维护了枚举值,又关联了数据字典
##### 一个例子
- 定义枚举值和字典数据选项,并注册字典类型
- 文件路径server/internal/consts/credit_log.go
```go
package consts
import (
"hotgo/internal/library/dict"
"hotgo/internal/model"
)
func init() {
dict.RegisterEnums("creditType", "资金变动类型", CreditTypeOptions)
dict.RegisterEnums("creditGroup", "资金变动分组", CreditGroupOptions)
}
const (
CreditTypeBalance = "balance" // 余额
CreditTypeIntegral = "integral" // 积分
)
const (
CreditGroupDecr = "decr" // 扣款
CreditGroupIncr = "incr" //
CreditGroupOpDecr = "op_decr" // 操作扣
CreditGroupOpIncr = "op_incr" // 操作
CreditGroupBalanceRecharge = "balance_recharge" // 余额充值
CreditGroupBalanceRefund = "balance_refund" // 余额退款
CreditGroupApplyCash = "apply_cash" // 申请提现
)
// CreditTypeOptions 变动类型
var CreditTypeOptions = []*model.Option{
dict.GenSuccessOption(CreditTypeBalance, "余额"),
dict.GenInfoOption(CreditTypeIntegral, "积分"),
}
// CreditGroupOptions 变动分组
var CreditGroupOptions = []*model.Option{
dict.GenWarningOption(CreditGroupDecr, "扣款"),
dict.GenSuccessOption(CreditGroupIncr, "款"),
dict.GenWarningOption(CreditGroupOpDecr, "操作扣款"),
dict.GenSuccessOption(CreditGroupOpIncr, "操作款"),
dict.GenWarningOption(CreditGroupBalanceRefund, "余额退款"),
dict.GenSuccessOption(CreditGroupBalanceRecharge, "余额充值"),
dict.GenInfoOption(CreditGroupApplyCash, "申请提现"),
}
```
#### 自定义方法字典
- 适用于非固定选项,如数据是从某个表/文件读取或从第三方读取,数据需要进行转换时使用
##### 方法字典接口
- 文件路径server/internal/consts/credit_log.go
```go
package dict
// FuncDict 方法字典,实现本接口即可使用内置方法字典
type FuncDict func(ctx context.Context) (res []*model.Option, err error)
```
##### 一个例子
- 定义获取字典数据方法,并注册字典类型
- 文件路径server/internal/logic/admin/post.go
```go
package admin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/dict"
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/service"
)
type sAdminPost struct{}
func NewAdminPost() *sAdminPost {
return &sAdminPost{}
}
func init() {
service.RegisterAdminPost(NewAdminPost())
dict.RegisterFunc("adminPostOption", "岗位选项", service.AdminPost().Option)
}
// Option 岗位选项
func (s *sAdminPost) Option(ctx context.Context) (opts []*model.Option, err error) {
var list []*entity.AdminPost
if err = dao.AdminPost.Ctx(ctx).OrderAsc(dao.AdminPost.Columns().Sort).Scan(&list); err != nil {
return nil, err
}
if len(list) == 0 {
opts = make([]*model.Option, 0)
return
}
for _, v := range list {
opts = append(opts, dict.GenHashOption(v.Id, v.Name))
}
return
}
```
#### 代码生成支持
- 内置的枚举字典和自定义方法字典在生成代码时可以直接进行选择,生成代码格式和系统字典管理写法一致
![最终编辑表单效果](images/sys-library-dict.png)
#### 内置字典和系统字典的区分
##### 主要区别
- 系统字典由表:`hg_sys_dict_type``hg_sys_dict_data`共同进行维护,使用时需通过后台到字典管理中进行添加
- 内置字典是系统开发期间在代码层面事先定义和注册好的数据选项
##### 数据格式区别
- 系统字典所有ID都是大于0的int64类型
- 内置字典ID都是小于0的int64类型。枚举字典以20000开头-200001381053496方法字典以30000开头-30000892528327开头以外数字是根据数据选项的`key`值进行哈希算法得出
### 地理定位
```go
// 待写
```
### 通知
```go
// 待写
## 功能扩展库
目录
- 缓存驱动
- 请求上下文
- JWT
- 数据字典
- 地理定位(待写)
- 通知(待写)
### 缓存驱动
> 系统默认的缓存驱动为file目前已支持memory|redis|file等多种驱动。请自行选择适合你的驱动使用。
- 配置文件server/manifest/config/config.yaml
```yaml
#缓存
cache:
adapter: "file" # 缓存驱动方式支持memory|redis|file不填默认memory
fileDir: "./storage/cache" # 文件缓存路径adapter=file时必填
```
#### 使用方式
```go
package main
import (
"hotgo/internal/library/cache"
"github.com/gogf/gf/v2/os/gctx"
)
func test() {
ctx := gctx.New()
// 添加/修改
cache.Instance().Set(ctx, "qwe", 123, 0)
// 查询
cache.Instance().Get(ctx, "qwe")
// 删除
cache.Instance().Remove(ctx, "qwe")
// 更多方法请参考https://goframe.org/pages/viewpage.action?pageId=27755640
}
```
### 请求上下文
- 主要用于在处理HTTP和websocket请求时通过中间件将用户、应用、插件等信息绑定到上下文中方便在做业务处理时用到这些信息
```go
package admin
import (
"fmt"
"context"
"hotgo/internal/library/contexts"
"hotgo/internal/library/addons"
)
func test(ctx context.Context) {
// 获取当前请求的所有上下文变量
var ctxModel = contexts.Get(ctx)
fmt.Printf("当前请求的所有上下文变量:%+v\n", ctxModel)
// 获取当前请求的应用模块
var module = contexts.GetModule(ctx)
fmt.Printf("当前请求的应用:%+v\n", module)
// 获取当前请求的用户信息
var member = contexts.GetUser(ctx)
fmt.Printf("当前访问用户信息:%+v\n", member)
// 获取当前请求的插件模块
fmt.Printf("当前是否为插件请求:%v", contexts.IsAddonRequest(ctx))
if contexts.IsAddonRequest(ctx) {
fmt.Printf("当前插件名称:%v", contexts.GetAddonName(ctx))
fmt.Printf("当前插件信息:%v", addons.GetModule(contexts.GetAddonName(ctx)))
}
}
```
### JWT
- 基于jwt+缓存驱动实现的用户登录令牌功能支持自动续约解决了jwt服务端无法退出问题和jwt令牌无法主动失效问题
#### 配置示例
```yaml
# 登录令牌
token:
secretKey: "hotgo123" # 令牌加密秘钥,考虑安全问题生产环境中请修改默认值
expires: 604800 # 令牌有效期单位秒。默认7天
autoRefresh: true # 是否开启自动刷新过期时间, false|true 默认为true
refreshInterval: 86400 # 刷新间隔单位秒。必须小于expires否则无法触发。默认1天内只允许刷新一次
maxRefreshTimes: 30 # 最大允许刷新次数,-1不限制。默认30次
multiLogin: true # 是否允许多端登录, false|true 默认为true
```
```go
package admin
import (
"fmt"
"context"
"hotgo/internal/library/token"
"hotgo/internal/model"
)
func test(ctx context.Context) {
// 登录
user := &model.Identity{
Id: mb.Id,
Pid: mb.Pid,
DeptId: mb.DeptId,
RoleId: ro.Id,
RoleKey: ro.Key,
Username: mb.Username,
RealName: mb.RealName,
Avatar: mb.Avatar,
Email: mb.Email,
Mobile: mb.Mobile,
App: consts.AppAdmin,
LoginAt: gtime.Now(),
}
loginToken, expires, err := token.Login(ctx, user)
if err != nil {
return nil, err
}
// gf请求对象
r := *ghttp.Request
// 获取登录用户信息
user, err := token.ParseLoginUser(r)
if err != nil {
return
}
// 注销登录
err = token.Logout(r)
}
```
### 数据字典
- hotgo增加了对枚举字典和自定义方法字典的内置支持从而在系统中经常使用的一些特定数据上做出了增强。
#### 字典数据选项
- 文件路径server/internal/model/dict.go
```go
package model
// Option 字典数据选项
type Option struct {
Key interface{} `json:"key"`
Label string `json:"label" description:"字典标签"`
Value interface{} `json:"value" description:"字典键值"`
ValueType string `json:"valueType" description:"键值数据类型"`
Type string `json:"type" description:"字典类型"`
ListClass string `json:"listClass" description:"表格回显样式"`
}
```
#### 枚举字典
- 适用于系统开发期间内置的枚举数据,这样即维护了枚举值,又关联了数据字典
##### 一个例子
- 定义枚举值和字典数据选项,并注册字典类型
- 文件路径server/internal/consts/credit_log.go
```go
package consts
import (
"hotgo/internal/library/dict"
"hotgo/internal/model"
)
func init() {
dict.RegisterEnums("creditType", "资金变动类型", CreditTypeOptions)
dict.RegisterEnums("creditGroup", "资金变动分组", CreditGroupOptions)
}
const (
CreditTypeBalance = "balance" // 余额
CreditTypeIntegral = "integral" // 积分
)
const (
CreditGroupDecr = "decr" //
CreditGroupIncr = "incr" //
CreditGroupOpDecr = "op_decr" // 操作
CreditGroupOpIncr = "op_incr" // 操作加款
CreditGroupBalanceRecharge = "balance_recharge" // 余额充值
CreditGroupBalanceRefund = "balance_refund" // 余额退款
CreditGroupApplyCash = "apply_cash" // 申请提现
)
// CreditTypeOptions 变动类型
var CreditTypeOptions = []*model.Option{
dict.GenSuccessOption(CreditTypeBalance, "余额"),
dict.GenInfoOption(CreditTypeIntegral, "积分"),
}
// CreditGroupOptions 变动分组
var CreditGroupOptions = []*model.Option{
dict.GenWarningOption(CreditGroupDecr, "款"),
dict.GenSuccessOption(CreditGroupIncr, "款"),
dict.GenWarningOption(CreditGroupOpDecr, "操作款"),
dict.GenSuccessOption(CreditGroupOpIncr, "操作加款"),
dict.GenWarningOption(CreditGroupBalanceRefund, "余额退款"),
dict.GenSuccessOption(CreditGroupBalanceRecharge, "余额充值"),
dict.GenInfoOption(CreditGroupApplyCash, "申请提现"),
}
```
#### 自定义方法字典
- 适用于非固定选项,如数据是从某个表/文件读取或从第三方读取,数据需要进行转换时使用
##### 方法字典接口
- 文件路径server/internal/consts/credit_log.go
```go
package dict
// FuncDict 方法字典,实现本接口即可使用内置方法字典
type FuncDict func(ctx context.Context) (res []*model.Option, err error)
```
##### 一个例子
- 定义获取字典数据方法,并注册字典类型
- 文件路径server/internal/logic/admin/post.go
```go
package admin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/dict"
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/service"
)
type sAdminPost struct{}
func NewAdminPost() *sAdminPost {
return &sAdminPost{}
}
func init() {
service.RegisterAdminPost(NewAdminPost())
dict.RegisterFunc("adminPostOption", "岗位选项", service.AdminPost().Option)
}
// Option 岗位选项
func (s *sAdminPost) Option(ctx context.Context) (opts []*model.Option, err error) {
var list []*entity.AdminPost
if err = dao.AdminPost.Ctx(ctx).OrderAsc(dao.AdminPost.Columns().Sort).Scan(&list); err != nil {
return nil, err
}
if len(list) == 0 {
opts = make([]*model.Option, 0)
return
}
for _, v := range list {
opts = append(opts, dict.GenHashOption(v.Id, v.Name))
}
return
}
```
#### 代码生成支持
- 内置的枚举字典和自定义方法字典在生成代码时可以直接进行选择,生成代码格式和系统字典管理写法一致
![最终编辑表单效果](images/sys-library-dict.png)
#### 内置字典和系统字典的区分
##### 主要区别
- 系统字典由表:`hg_sys_dict_type``hg_sys_dict_data`共同进行维护,使用时需通过后台到字典管理中进行添加
- 内置字典是系统开发期间在代码层面事先定义和注册好的数据选项
##### 数据格式区别
- 系统字典所有ID都是大于0的int64类型
- 内置字典ID都是小于0的int64类型。枚举字典以20000开头-200001381053496方法字典以30000开头-30000892528327开头以外数字是根据数据选项的`key`值进行哈希算法得出
### 地理定位
```go
// 待写
```
### 通知
```go
// 待写
```

View File

@@ -1,249 +1,250 @@
## 中间件/拦截器
目录
- 介绍
- 全局中间件
- 鉴权中间件
- 响应中间件
- 更多
### 介绍
- 在hotgo中中间件/拦截器主要作用于web请求的上下文预设、跨域请求处理、鉴权处理、请求拦截和请求结束后统一响应处理等。
### 全局中间件
```go
package main
import (
"hotgo/internal/service"
)
func main() {
// 初始化请求上下文,一般需要第一个进行加载,后续中间件存在依赖关系
service.Middleware().Ctx()
// 跨域中间件,自动处理跨域问题
service.Middleware().CORS()
// IP黑名单中间件如果请求IP被后台拉黑所有请求将被拒绝
service.Middleware().Blacklist()
// 演示系統操作限制当开启演示模式时所有POST请求将被拒绝
service.Middleware().DemoLimit()
// 请求输入预处理api使用gf规范路由并且XxxReq结构体实现了validate.Filter接口即可隐式预处理
service.Middleware().PreFilter()
// HTTP响应预处理在业务处理完成后对响应结果进行格式化和错误过滤将处理后的数据发送给请求方
service.Middleware().ResponseHandler()
}
```
### 鉴权中间件
```go
package main
import (
"github.com/gogf/gf/v2/frame/g"
)
func main() {
// 在鉴权中间件下的路由如果没有通过权限验证,后续请求将被拒绝
// 在hotgo中鉴权中间件一般是配合一个业务模块下的路由组进行使用
// 目前admin、api、home、websocket模块都已接入
// 如果你需要创建一个新的模块也需要用到鉴权中间件可以参考server/internal/logic/middleware/admin_auth.go
// 一个简单例子
s := g.Server()
s.Group("/api", func(group *ghttp.RouterGroup) {
group.Middleware(service.Middleware().ApiAuth)
group.Bind(
member.Member, // 管理员
)
})
}
```
### 响应中间件
- 文件路径server/internal/logic/middleware/response.go
#### 常用响应类型
- hotgo为一些常用的响应类型做了统一格式封装例如`application/json``text/xml``text/html``text/event-stream`等,默认使用`application/json`
- 下面我们以`text/xml`为例简单演示几种使用方法:
1. 当你使用规范化路由时可直接在XxxRes结构体的`g.Meta`中声明响应类型:
```go
type HelloReq struct {
g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
Name string `json:"name" d:"hotgo" dc:"名字"`
}
type HelloRes struct {
g.Meta `mime:"text/xml" type:"string"`
Tips string `json:"tips"`
}
```
2. 在响应前设置响应头:
```go
var (
Hello = cHello{}
)
type cHello struct{}
func (c *cHello) Hello(ctx context.Context, req *user.HelloReq) (res *user.HelloRes, err error) {
r := ghttp.RequestFromCtx(ctx)
r.Response.Header().Set("Content-Type", "text/xml")
res = &user.HelloRes{
Tips: fmt.Sprintf("hello %v, this is the api for %v applications.", req.Name, simple.AppName(ctx)),
}
return
}
```
- 浏览器中访问响应内容如下:
![./images/sys-middleware-com-response.png](./images/sys-middleware-com-response.png)
#### 自定义响应
- 在实际开发中,可能需要使用自定义的响应类型,由于响应中间件是全局的,因此您需要对其进行单独处理。
- 推荐以下几种处理方案,可做参考:
1. 使用`ghttp.ExitAll()`需要注意的是此方法会终止后续所有的http处理
```go
package main
import (
"github.com/gogf/gf/v2/net/ghttp"
)
func main() {
r := new(ghttp.Request) // 当前请求对象
// 清空响应
r.Response.ClearBuffer()
// 写入响应
r.Response.Write("自定义响应内容")
// 终止后续http处理
r.ExitAll()
}
```
2.`server/internal/logic/middleware/response.go`中根据请求的独有特征进行单独的处理兼容后续http处理。
#### 重写响应错误提示
- 在实际开发中我们可能想要隐藏一些敏感错误返回给客户端友好的错误提示但开发者同时又想需要看到真实的敏感错误。对此hotgo已经进行了过滤处理下面是一个简单的例子
```go
package main
import (
"github.com/gogf/gf/v2/errors/gerror"
)
func test() error {
err = gerror.New("这是一个sql执行错误")
err = gerror.Wrap(err, "用户创建失败,请稍后重试!~")
return err
}
```
- 开启debug时的客户端响应
```json
{
"code": -1,
"message": "用户创建失败,请稍后重试!~",
"error": [
"1. 用户创建失败,请稍后重试!~",
" 1). hotgo/internal/logic/admin.(*sAdminMember).List",
" E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/admin/member.go:526",
"2. 这是一个sql执行错误", " 1). hotgo/internal/logic/admin.(*sAdminMember).List",
" E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/admin/member.go:525",
" 2). hotgo/internal/controller/admin/admin.(*cMember).List",
" E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/controller/admin/admin/member.go:157", ""
],
"timestamp": 1684145107,
"traceID": "084022730d495f17f19e550140f3e1a8"
}
```
- 关闭debug时的客户端响应
```json
{
"code": -1,
"message": "用户创建失败,请稍后重试!~",
"timestamp": 1684145107,
"traceID": "084022730d495f17f19e550140f3e1a8"
}
```
- 控制台的输出日志:
```shell
2023-05-15 18:05:07.776 {084022730d495f17f19e550140f3e1a8} 200 "GET http localhost:8000 /admin/member/list?page=1&pageSize=10&roleId=-1 HTTP/1.1" 0.002, 127.0.0.1, "http://192.168.0.207:8001/login", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Co
re/1.94.197.400 QQBrowser/11.7.5287.400", -1, "", ""
Stack:
1. 用户创建失败,请稍后重试!~
1). hotgo/internal/logic/admin.(*sAdminMember).List
E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/admin/member.go:526
2. 这是一个sql执行错误
1). hotgo/internal/logic/admin.(*sAdminMember).List
E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/middleware/response.go:24
13). hotgo/internal/logic/middleware.(*sMiddleware).DemoLimit
E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/middleware/init.go:90
```
- 如果你开启了访问日志,那么日志记录中会详细记录本次请求的相关信息,内容如下:
![./images/sys-middleware-error-log.png](./images/sys-middleware-error-log.png)
#### 重写错误码
- hotgo默认使用了gf内置的错误码进行业务处理通常情况下成功状态码为`0`,失败状态码为`-1`
- 查看gf内置错误码https://goframe.org/pages/viewpage.action?pageId=30739587
- 以下是自定义错误码的简单例子:
```go
package main
import (
"github.com/gogf/gf/v2/errors/gerror"
)
func test() error {
// 使用自定义状态码30001响应客户端
err = gerror.NewCode(gcode.New(30001, "用户创建失败,请稍后重试!~", nil))
return err
}
```
- 客户端响应如下:
```json
{
"code": 30001,
"message": "用户创建失败,请稍后重试!~",
"timestamp": 1684146313,
"traceID": "b4f90e16264a5f17cd3fc27141aba448"
}
```
### 更多
- 更多关于中间件/拦截器的介绍请参考https://goframe.org/pages/viewpage.action?pageId=55289881
## 中间件/拦截器
目录
- 介绍
- 全局中间件
- 鉴权中间件
- 响应中间件
- 更多
### 介绍
- 在hotgo中中间件/拦截器主要作用于web请求的上下文预设、跨域请求处理、鉴权处理、请求拦截和请求结束后统一响应处理等。
### 全局中间件
```go
package main
import (
"hotgo/internal/service"
)
func main() {
// 初始化请求上下文,一般需要第一个进行加载,后续中间件存在依赖关系
service.Middleware().Ctx()
// 跨域中间件,自动处理跨域问题
service.Middleware().CORS()
// IP黑名单中间件如果请求IP被后台拉黑所有请求将被拒绝
service.Middleware().Blacklist()
// 演示系統操作限制当开启演示模式时所有POST请求将被拒绝
service.Middleware().DemoLimit()
// 请求输入预处理api使用gf规范路由并且XxxReq结构体实现了validate.Filter接口即可隐式预处理
service.Middleware().PreFilter()
// HTTP响应预处理在业务处理完成后对响应结果进行格式化和错误过滤将处理后的数据发送给请求方
service.Middleware().ResponseHandler()
}
```
### 鉴权中间件
```go
package main
import (
"github.com/gogf/gf/v2/frame/g"
)
func main() {
// 在鉴权中间件下的路由如果没有通过权限验证,后续请求将被拒绝
// 在hotgo中鉴权中间件一般是配合一个业务模块下的路由组进行使用
// 目前admin、api、home、websocket模块都已接入
// 如果你需要创建一个新的模块也需要用到鉴权中间件可以参考server/internal/logic/middleware/admin_auth.go
// 一个简单例子
s := g.Server()
s.Group("/api", func(group *ghttp.RouterGroup) {
group.Middleware(service.Middleware().ApiAuth)
group.Bind(
member.Member, // 管理员
)
})
}
```
### 响应中间件
- 文件路径server/internal/logic/middleware/response.go
#### 常用响应类型
- hotgo为一些常用的响应类型做了统一格式封装例如`application/json``text/xml``text/html``text/event-stream`等,默认使用`application/json`
- 下面我们以`text/xml`为例简单演示几种使用方法:
1. 当你使用规范化路由时可直接在XxxRes结构体的`g.Meta`中声明响应类型:
```go
type HelloReq struct {
g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
Name string `json:"name" d:"hotgo" dc:"名字"`
}
type HelloRes struct {
g.Meta `mime:"text/xml" type:"string"`
Tips string `json:"tips"`
}
```
2. 在响应前设置响应头:
```go
var (
Hello = cHello{}
)
type cHello struct{}
func (c *cHello) Hello(ctx context.Context, req *user.HelloReq) (res *user.HelloRes, err error) {
r := ghttp.RequestFromCtx(ctx)
r.Response.Header().Set("Content-Type", "text/xml")
res = &user.HelloRes{
Tips: fmt.Sprintf("hello %v, this is the api for %v applications.", req.Name, simple.AppName(ctx)),
}
return
}
```
- 浏览器中访问响应内容如下:
![./images/sys-middleware-com-response.png](./images/sys-middleware-com-response.png)
#### 自定义响应
- 在实际开发中,可能需要使用自定义的响应类型,由于响应中间件是全局的,因此您需要对其进行单独处理
- 推荐以下几种处理方案,可做参考:
1. 使用`ghttp.ExitAll()`需要注意的是此方法会终止后续所有的http处理
```go
package main
import (
"github.com/gogf/gf/v2/net/ghttp"
)
func main() {
r := new(ghttp.Request) // 当前请求对象
// 清空响应
r.Response.ClearBuffer()
// 写入响应
r.Response.Write("自定义响应内容")
// 终止后续http处理
r.ExitAll()
}
```
2.`server/internal/logic/middleware/response.go`中根据请求的独有特征进行单独的处理兼容后续http处理。
#### 重写响应错误提示
- 在实际开发中我们可能想要隐藏一些敏感错误返回给客户端友好的错误提示但开发者同时又想需要看到真实的敏感错误。对此hotgo已经进行了过滤处理下面是一个简单的例子
```go
package main
import (
"github.com/gogf/gf/v2/errors/gerror"
)
func test() error {
err = gerror.New("这是一个sql执行错误")
err = gerror.Wrap(err, "用户创建失败,请稍后重试!~")
return err
}
```
- 开启debug时的客户端响应
```json
{
"code": -1,
"message": "用户创建失败,请稍后重试!~",
"error": [
"1. 用户创建失败,请稍后重试!~",
" 1). hotgo/internal/logic/admin.(*sAdminMember).List",
" E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/admin/member.go:526",
"2. 这是一个sql执行错误", " 1). hotgo/internal/logic/admin.(*sAdminMember).List",
" E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/admin/member.go:525",
" 2). hotgo/internal/controller/admin/admin.(*cMember).List",
" E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/controller/admin/admin/member.go:157", ""
],
"timestamp": 1684145107,
"traceID": "084022730d495f17f19e550140f3e1a8"
}
```
- 关闭debug时的客户端响应
```json
{
"code": -1,
"message": "用户创建失败,请稍后重试!~",
"timestamp": 1684145107,
"traceID": "084022730d495f17f19e550140f3e1a8"
}
```
- 控制台的输出日志:
```shell
2023-05-15 18:05:07.776 {084022730d495f17f19e550140f3e1a8} 200 "GET http localhost:8000 /admin/member/list?page=1&pageSize=10&roleId=-1 HTTP/1.1" 0.002, 127.0.0.1, "http://192.168.0.207:8001/login", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Co
re/1.94.197.400 QQBrowser/11.7.5287.400", -1, "", ""
Stack:
1. 用户创建失败,请稍后重试!~
1). hotgo/internal/logic/admin.(*sAdminMember).List
E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/admin/member.go:526
2. 这是一个sql执行错误
1). hotgo/internal/logic/admin.(*sAdminMember).List
E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/middleware/response.go:24
13). hotgo/internal/logic/middleware.(*sMiddleware).DemoLimit
E:/Users/Administrator/Desktop/gosrc/hotgo_dev/server/internal/logic/middleware/init.go:90
```
- 如果你开启了访问日志,那么日志记录中会详细记录本次请求的相关信息,内容如下:
![./images/sys-middleware-error-log.png](./images/sys-middleware-error-log.png)
#### 重写错误码
- hotgo默认使用了gf内置错误码进行业务处理,通常情况下成功状态码为`0`,失败状态码为`-1`
- 查看gf内置错误码https://goframe.org/pages/viewpage.action?pageId=30739587
- 以下是自定义错误码的简单例子:
```go
package main
import (
"github.com/gogf/gf/v2/errors/gerror"
)
func test() error {
// 使用自定义状态码30001响应客户端
err = gerror.NewCode(gcode.New(30001, "用户创建失败,请稍后重试!~", nil))
return err
}
```
- 客户端响应如下:
```json
{
"code": 30001,
"message": "用户创建失败,请稍后重试!~",
"timestamp": 1684146313,
"traceID": "b4f90e16264a5f17cd3fc27141aba448"
}
```
### 更多
- 更多关于中间件/拦截器的介绍请参考https://goframe.org/pages/viewpage.action?pageId=55289881

View File

@@ -44,6 +44,7 @@ SaaS系统多租户多应用设计已成为互联网企业的重要发展建
- 在用户登录成功后server端可通过上下文来获取用户部门类型来确定用户身份
- 文件路径server/internal/library/contexts/context.go
```go
package contexts
@@ -87,6 +88,7 @@ func IsUserDept(ctx context.Context) bool {
- 在用户登录成功后web端可通`useUserStore`来获取用户部门类型来确定用户身份
- 文件路径web/src/store/modules/user.ts
```vue
<script lang="ts" setup>
import { useUserStore } from '@/store/modules/user';
@@ -125,6 +127,7 @@ HotGo定位是中小型应用开发推荐采用一套数据库不同Schema。
下面是多租户功能演示例子代码中的使用片段
- 封装查询Model
```go
// Model 多租户功能演示ORM模型
func (s *sSysTenantOrder) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {

View File

@@ -12,6 +12,7 @@
### 全局消息监听
- 所有全局的消息监听都在这里
- 文件路径web/src/utils/websocket/registerMessage.ts
```ts
import { TABS_ROUTES } from '@/store/mutation-types';
import { SocketEnum } from '@/enums/socketEnum';
@@ -51,6 +52,7 @@ export function registerGlobalMessage() {
#### 单页面消息监听
- 当你只需要某个页面使用WebSocket这将是一个不错的选择下面是一个简单的演示例子
- 文件路径web/src/views/addons/hgexample/portal/websocketTest.vue
```vue
<template>
<div>
@@ -190,6 +192,7 @@ export function registerGlobalMessage() {
#### 发送消息
- 向服务器发送一条消息
```ts
import { sendMsg } from '@/utils/websocket';

View File

@@ -16,6 +16,7 @@
#### 1.消息处理接口
- 消息处理在设计上采用了接口化的思路。只需要实现以下接口即可进行WebSocket消息注册
- 文件路径server/internal/websocket/model.go
```go
package websocket
@@ -26,6 +27,7 @@ type EventHandler func(client *Client, req *WRequest)
#### 2.定义消息处理方法
- 以下是功能案例中的一个简单演示,实现了消息处理接口,并将收到的消息原样发送给客户端
- 文件路径server/addons/hgexample/controller/websocket/handler/index.go
```go
package handler
@@ -52,6 +54,7 @@ func (c *cIndex) TestMessage(client *websocket.Client, req *websocket.WRequest)
#### 3.注册消息
- 定义消息处理方法后需要将其注册到WebSocket消息处理器一般放在对应应用模块的`router/websocket.go`下即可
- 文件路径server/addons/hgexample/router/websocket.go
```go
package router
@@ -80,6 +83,7 @@ func WebSocket(ctx context.Context, group *ghttp.RouterGroup) {
### 常用方法
- websocket服务器还提供了一些常用的方法下面只对部分进行说明
```go
func test() {
websocket.SendToAll() // 发送全部客户端
@@ -105,6 +109,7 @@ func test() {
### 其他
- WebSocket被连接时需验证用户认证中间件所以用户必须登录成功后才能连接成功
- 参考文件server/internal/logic/middleware/weboscket_auth.go
```go
package middleware

View File

@@ -4,168 +4,183 @@
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no, viewport-fit=cover">
content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no, viewport-fit=cover">
<!-- Replace with your own title and description. -->
<title>HotGo-V2</title>
<meta name="description" content="基于全新GoFrame2+Vue3+NaiveUI+uniapp开发的全栖框架为二次开发而生适合中小型完整应用开发。">
<!-- Default Theme (see https://docsify.js.org/#/themes) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
<!-- Default Theme (see //docsify.js.org/#/themes) -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<div id="app"></div>
<script>
// Docsify Configuration (see https://docsify.js.org/#/configuration)
window.$docsify = {
name: "HotGo-V2",
nameLink: {
'/': '/hotgo/',
<script>
// Docsify Configuration (see //docsify.js.org/#/configuration)
window.$docsify = {
name: "HotGo-V2",
nameLink: {
'/': '/hotgo/',
},
relativePath: true,
// alias: {
// "/.*/_navbar.md": "/_navbar.md",
// },
// themeColor: "#42b983",
// logo: "//bufanyun.cn-bj.ufileos.com/hotgo/logo.sig.png",
// coverpage: true,
// homepage: "README.md",
// Sidebar Configuration
auto2top: true,
loadSidebar: "sidebar.md",
// maxLevel: 2,
// Set subMaxLevel to 0 to remove automatic display of page table of contents (TOC) in Sidebar
// subMaxLevel: 3,
// Navbar Configuration
// loadNavbar: true,
// Search Plugin Configuration
search: {
placeholder: {
"/": "搜索",
// "/": "Type to search"
},
relativePath: true,
// alias: {
// "/.*/_navbar.md": "/_navbar.md",
// },
// themeColor: "#42b983",
// logo: "https://bufanyun.cn-bj.ufileos.com/hotgo/logo.sig.png",
// coverpage: true,
// homepage: "README.md",
// Sidebar Configuration
auto2top: true,
loadSidebar: "sidebar.md",
// maxLevel: 2,
// Set subMaxLevel to 0 to remove automatic display of page table of contents (TOC) in Sidebar
// subMaxLevel: 3,
// Navbar Configuration
// loadNavbar: true,
// Search Plugin Configuration
search: {
placeholder: {
"/": "搜索",
// "/": "Type to search"
},
noData: {
"/": "找不到结果",
// "/": "No Results"
},
// Headline depth, 1 - 6
// depth: 2,
noData: {
"/": "找不到结果",
// "/": "No Results"
},
// Headline depth, 1 - 6
// depth: 2,
},
// Flexible-alerts Plugin Configuration
"flexible-alerts": {
important: {
label: "Important",
// Flexible-alerts Plugin Configuration
"flexible-alerts": {
important: {
label: "Important",
// localization
label: {
// "/zh-cn": "重要",
"/": "Important"
},
// Assuming that we use Font Awesome
icon: "far fa-message",
className: "important"
// localization
label: {
// "/zh-cn": "重要",
"/": "Important"
},
warning: {
label: "Warning",
// localization
label: {
// "/zh-cn": "警告",
"/": "Warning"
},
// Assuming that we use Font Awesome
icon: "far fa-message",
className: "important"
},
warning: {
label: "Warning",
// Assuming that we use Font Awesome
icon: "fas fa-triangle-exclamation",
className: "warning"
// localization
label: {
// "/zh-cn": "警告",
"/": "Warning"
},
caution: {
label: "Caution",
// localization
label: {
// "/zh-cn": "注意",
"/": "Caution"
},
// Assuming that we use Font Awesome
icon: "fas fa-triangle-exclamation",
className: "warning"
},
caution: {
label: "Caution",
// Assuming that we use Font Awesome
icon: "fas fa-circle-exclamation",
className: "attention"
// localization
label: {
// "/zh-cn": "注意",
"/": "Caution"
},
// Assuming that we use Font Awesome
icon: "fas fa-circle-exclamation",
className: "attention"
},
},
// Hide-code Plugin Configuration
hideCode: {
// scroll: false, // Enable scrolling
height: 300 // Max height
},
// Hide-code Plugin Configuration
hideCode: {
// scroll: false, // Enable scrolling
height: 300 // Max height
},
// Versioned Plugin Configuration
// versions: [
// { folder: "/", label: "v2", default: true },
// ],
// versionSelectorLabel: "Version",
// Versioned Plugin Configuration
// versions: [
// { folder: "/", label: "v2", default: true },
// ],
// versionSelectorLabel: "Version",
// Progress Plugin Configuration
progress: {
position: "top",
// color: "var(--theme-color,#42b983)",
height: "3px",
},
};
</script>
// Progress Plugin Configuration
progress: {
position: "top",
// color: "var(--theme-color,#42b983)",
height: "3px",
},
};
</script>
<!-- Required -->
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script>
<!-- Required -->
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script>
<!-- Recommended -->
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/zoom-image.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-hide-code/dist/docsify-hide-code.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-progress@latest/dist/progress.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-example-panels"></script>
<!-- Recommended -->
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/zoom-image.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-hide-code/dist/docsify-hide-code.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-progress@latest/dist/progress.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-example-panels"></script>
<!-- Prism code highlight -->
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-matlab.min.js"></script>
<!-- Prism code highlight -->
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-matlab.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-go.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-yaml.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-vue.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-json.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-sql.min.js"></script>
<!-- docsify-dark-switcher -->
<script src="https://cdn.jsdelivr.net/gh/LIGMATV/docsify-dark-switcher@latest/docsify-dark-switcher.js"></script>
<style>
:root {
--dark-base-background: #222;
--dark-base-color: #bbc0c4;
--dark-theme-color: var(--theme-color, #42b983);
--dark-code-color: var(--dark-color);
--dark-heading-color: var(--dark-theme-color);
--dark-cover-background: #000000a8;
--dark-code-background: #303030;
--dark-tip-background: #2c0000;
--dark-warn-background: #005842;
--dark-icon-size: 25px;
--dark-icon-transition: .1s ease-in-out .1s;
--dark-moon-color: #000000;
--dark-sun-color: #ffffff;
}
</style>
<!--mermaid插件-->
<script type="module">
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
mermaid.initialize({ startOnLoad: true });
window.mermaid = mermaid;
</script>
<script src="//unpkg.com/docsify-mermaid@2.0.1/dist/docsify-mermaid.js"></script>
<!-- docsify-dark-switcher -->
<script src="//cdn.jsdelivr.net/gh/LIGMATV/docsify-dark-switcher@latest/docsify-dark-switcher.js"></script>
<style>
:root {
--dark-base-background: #222;
--dark-base-color: #bbc0c4;
--dark-theme-color: var(--theme-color, #42b983);
--dark-code-color: var(--dark-color);
--dark-heading-color: var(--dark-theme-color);
--dark-cover-background: #000000a8;
--dark-code-background: #303030;
--dark-tip-background: #2c0000;
--dark-warn-background: #005842;
--dark-icon-size: 25px;
--dark-icon-transition: .1s ease-in-out .1s;
--dark-moon-color: #000000;
--dark-sun-color: #ffffff;
}
</style>
<!-- docsify-plugin-flexible-alerts -->
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-flexible-alerts/dist/docsify-plugin-flexible-alerts.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/js/all.min.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/fontawesome.min.css">
<!-- docsify-versioned-plugin -->
<!-- <script src="//cdn.jsdelivr.net/npm/docsify-versioned-plugin@0.0.1/index.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify-versioned-plugin@0.0.1/styles.css"> -->
<!-- docsify-plugin-flexible-alerts -->
<script src="https://cdn.jsdelivr.net/npm/docsify-plugin-flexible-alerts/dist/docsify-plugin-flexible-alerts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/js/all.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/fontawesome.min.css">
<!-- docsify-versioned-plugin -->
<!-- <script src="https://cdn.jsdelivr.net/npm/docsify-versioned-plugin@0.0.1/index.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-versioned-plugin@0.0.1/styles.css"> -->
</body>

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

@@ -57,4 +57,5 @@ var HTTPHandlerTimeOptions = []*model.Option{
var HTTPApiCodeOptions = []*model.Option{
dict.GenSuccessOption(gcode.CodeOK.Code(), fmt.Sprintf("%v %v", gcode.CodeOK.Code(), "成功")),
dict.GenWarningOption(gcode.CodeNil.Code(), fmt.Sprintf("%v %v", gcode.CodeNil.Code(), "失败")),
dict.GenWarningOption(gcode.CodeSecurityReason.Code(), fmt.Sprintf("%v %v", gcode.CodeSecurityReason.Code(), "无访问权限")),
}

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.16.10"
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"
)

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