Skip to content

Latest commit

 

History

History
161 lines (146 loc) · 4.58 KB

内置指令.md

File metadata and controls

161 lines (146 loc) · 4.58 KB

dolphin

整个框架由内置命令和platform组成, 自带的指令集合用于快速生成常规代码。

Code generation tool for golang

Usage:
  dolphin [command]

Available Commands:
  assert      Generate Go code that statically implements input filesystem
  build       Build from the configuration file
  clean       Remove temp file, such as *.go.new
  help        Help about any command
  more        Add controller and table
  new         New a empty project
  reverse     Inversion of the data model
  serve       Serve api document

Flags:
  -h, --help   help for dolphin

Use "dolphin [command] --help" for more information about a command.

new

通过new指令可以创建一个新的项目

$ dolphin new hello
$ tree hello
hello/
├── app.properties
├── Dockerfile
├── go.mod
├── go.sum
├── README.md
└── xml
    ├── application.xml
    ├── bean
    │   └── article_info.xml
    ├── controller
    │   └── article.xml
    ├── rpc
    │   └── article.xml
    └── table
        └── article.xml

build

build指令是用来编译xml并转换成对应的服务。

$ dolphin build
$ tree hello
hello
├── api
│   ├── app.auto.go
│   ├── app.go
│   └── article.go
├── app.properties
├── Dockerfile
├── go.mod
├── go.sum
├── k8s
│   ├── configmap.yaml
│   ├── destinationrule.yaml
│   ├── gateway.yaml
│   ├── ingress.yaml
│   ├── pvc.yaml
│   ├── service.yaml
│   ├── statefulset.yaml
│   ├── tls.yaml
│   └── virtualservice.yaml
├── main.go
├── README.md
├── rpc
│   ├── article.cli.go
│   ├── article.go
│   └── proto
│       ├── article.pb.go
│       └── article.proto
├── script
│   ├── apis
│   │   ├── article.js
│   │   └── index.js
│   └── request.js
├── sql
│   ├── article
│   │   ├── article_page_count.tpl
│   │   └── article_page_select.tpl
│   └── sqlmap
│       └── article.xml
├── srv
│   └── article.go
├── static
│   └── web
│       ├── affirm.html
│       └── login.html
├── svc
│   ├── svc.go
│   └── svc.helper.go
├── swagger.json
├── types
│   ├── article.auto.go
│   └── article_info.auto.go
├── util
│   └── common.go
├── x_hello_test.go
├── xml
│   ├── application.xml
│   ├── bean
│   │   └── article_info.xml
│   ├── controller
│   │   └── article.xml
│   ├── rpc
│   │   └── article.xml
│   └── table
│       └── article.xml
└── x_test.go

more

more指令是用来快速创建table和controll。

$ dolphin more idx_blog
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/main.go skip generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/api/app.go skip generate 
WARN[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/api/app.auto.go over generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/Dockerfile skip generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/static/web/affirm.html skip generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/static/web/login.html skip generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/util/common.go skip generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/svc/svc.go skip generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/svc/svc.helper.go skip generate 
WARN[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/x_test.go over generate 
INFO[2021/07/20 14:08:42] /home/double/Work/i2/repo/dolphin/examples/hello/x_hello_test.go.new inc generate 
WARN[2021/07/20 14:08:42] script/request.js over generate              
WARN[2021/07/20 14:08:42] script/apis/index.js over generate          

clean

clean可以用来删除临时文件。

$ dolphin clean

serve

serve可以在线浏览swagger文档。

$ dolphin serve

reverse

reverse可以用反转生成数据库对应的模型。

$ dolphin reverse