feat: 增强命令帮助文档,添加详细说明和示例

This commit is contained in:
Rogee
2025-09-12 10:33:57 +08:00
parent a96df4d628
commit ee15e0932a
17 changed files with 217 additions and 52 deletions

View File

@@ -18,6 +18,19 @@ func CommandGenModel(root *cobra.Command) {
Use: "model",
Aliases: []string{"m"},
Short: "Generate models",
Long: `根据数据库连接配置生成模型代码,输出到 ./database并支持基于 ./database/.transform.yaml 的类型/命名转换。
配置:通过 -c/--config 指定配置文件(默认 config.toml从 [Database] 段读取:
Username, Password, Database, Host, Port, Schema, SslMode, TimeZone
行为:
- 解析 go.mod 以识别项目模块名
- 连接 PostgreSQLgorm + postgres driver校验连通性
- 调用 go.ipao.vip/gen 生成模型与相关文件到 ./database
- 根据 .transform.yaml 应用转换规则
示例:
atomctl gen -c config.toml model`,
RunE: commandGenModelE,
}