gin-admin-cli

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 4 Imported by: 0

README

gin-admin-cli - gin-admin

GinAdmin辅助工具

下载并使用

$ go get -u -v github.com/LyricTian/gin-admin-cli
创建项目
USAGE:
   gin-admin-cli new [command options] [arguments...]

OPTIONS:
   --dir value, -d value  项目生成目录
   --pkg value, -p value  项目包名
   --mirror, -m           使用国内镜像(gitee.com)
   --web, -w              包含web项目

使用示例

$ gin-admin-cli new -m -d ~/go/src/test-gin-admin -p test-gin-admin
生成业务模块
指定模块名称和说明生成模块
USAGE:
   gin-admin-cli generate [command options] [arguments...]

OPTIONS:
   --dir value, -d value      项目生成目录
   --pkg value, -p value      项目包名
   --name value, -n value     模块名称(结构体名称)
   --comment value, -c value  模块注释
   --file value, -f value     指定模板文件(.json,模板配置可参考说明)

使用示例

$ gin-admin-cli g -d ./test-gin-admin -p test-gin-admin -n Task -c '任务管理'
指定配置文件生成模块
$ gin-admin-cli g -d 项目目录 -p 包名 -f 配置文件(json)

配置文件说明

{
  "struct_name": "结构体名称",
  "comment": "结构体注释说明",
  "fields": [
    {
      "struct_field_name": "结构体字段名称",
      "comment": "结构体字段注释",
      "struct_field_required": "结构体字段是否是必选项",
      "struct_field_type": "结构体字段类型",
      "gorm_options": "gorm配置项"
    }
  ]
}

使用示例

创建task.json文件

{
  "struct_name": "Task",
  "comment": "任务管理",
  "fields": [
    {
      "struct_field_name": "RecordID",
      "comment": "记录ID",
      "struct_field_required": false,
      "struct_field_type": "string",
      "gorm_options": "size:36;index;"
    },
    {
      "struct_field_name": "Name",
      "comment": "任务名称",
      "struct_field_required": true,
      "struct_field_type": "string",
      "gorm_options": "size:50;index;"
    },
    {
      "struct_field_name": "Memo",
      "comment": "备注",
      "struct_field_required": false,
      "struct_field_type": "string",
      "gorm_options": "size:500;"
    },
    {
      "struct_field_name": "Creator",
      "comment": "创建者",
      "struct_field_required": false,
      "struct_field_type": "string",
      "gorm_options": "size:36;index;"
    }
  ]
}
$ gin-admin-cli g -d ./test-gin-admin -p test-gin-admin -f task.json

MIT License

Copyright (c) 2019 Lyric

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
new

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL