2 Star 1 Fork 3

Lyric / gin-admin-cli

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

gin-admin-cli - gin-admin

gin-admin v8.0 辅助工具,提供创建项目、快速生成功能模块的功能

下载并使用

go get -u github.com/gin-admin/gin-admin-cli/v5

创建项目

USAGE:
   gin-admin-cli new [command options] [arguments...]

OPTIONS:
   --dir value, -d value     项目生成目录 (默认GOPATH)
   --pkg value, -p value     项目包名
   --branch value, -b value  指定分支 (默认master)
   --mirror, -m              使用国内镜像 (gitee.com)
   --web, -w                 包含web项目

使用示例

gin-admin-cli new -p test-gin-admin -m

生成业务模块

指定模块名称和说明生成模块

USAGE:
   gin-admin-cli generate [command options] [arguments...]

OPTIONS:
   --dir value, -d value      项目生成目录(默认GOPATH)
   --pkg value, -p value      项目包名
   --name value, -n value     业务模块名称(结构体名称)
   --comment value, -c value  业务模块注释(结构体注释)
   --file value, -f value     指定模板文件(.yaml,模板配置可参考说明)
   --module value, -m value   指定生成模块(默认生成全部模块,以逗号分隔,支持:schema,dao,service,api,mock,router)

使用示例

gin-admin-cli g -p test-gin-admin -n Task -c '任务管理'

指定配置文件生成模块

gin-admin-cli g -p 包名 -f 配置文件(yaml)

配置文件说明

---
name: 结构体名称
comment: 结构体注释说明
fields:
  - name: 结构体字段名称
    type: 结构体字段类型
    comment: 结构体字段注释
    required: 结构体字段是否是必选项
    binding_options: binding配置项(不包含required,required由required字段控制)
    gorm_options: gorm配置项
使用示例

创建task.yaml文件

name: Task
comment: 任务管理
fields:
  - name: Code
    type: string
    comment: 任务编号
    required: true
    binding_options: ""
    gorm_options: "size:50;index;"
  - name: Name
    type: string
    comment: 任务名称
    required: true
    binding_options: ""
    gorm_options: "size:50;index;"
  - name: Memo
    type: string
    comment: 任务备注
    required: false
    binding_options: ""
    gorm_options: "size:1024;"
gin-admin-cli g -p test-gin-admin -f task.yaml

MIT License

Copyright (c) 2021 Lyric

MIT License Copyright (c) 2019 Lyric Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

gin-admin 辅助工具,提供创建项目、快速生成功能模块的功能 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/lyric/gin-admin-cli.git
git@gitee.com:lyric/gin-admin-cli.git
lyric
gin-admin-cli
gin-admin-cli
master

搜索帮助