Skip to content

Latest commit

 

History

History
100 lines (90 loc) · 2.88 KB

快速入门.md

File metadata and controls

100 lines (90 loc) · 2.88 KB

dolphin 是一个贴近业务和代码规范的工具类web框架, 结合服务网格快速搭建整个微服应用体系,在实际应用中我们选择了istio作为微服治理方案。

快速入手

  • 安装dolphin命令
$ go get -u github.com/2637309949/dolphin/cmd/dolphin
  • 使用dolphin命令创建项目
$ dolphin new hello && cd hello && dolphin build && go run main.go
  • 根据需要创建对应的xml, 也可以使用more指令一键生成table, controller
$ dolphin more wechat_article
  • 测试接口, 默认会生成普通测试用列和压力测试用例, 只需填写测试数据和逻辑即可
$ go test -v ./... -test.run TestArticlePage
$ go test -v -test.run=none -test.bench=^BenchmarkArticlePage -test.benchmem=true

目录结构

准目录结构如下面所示, 这是简化且推荐的目录结构, 当需要使用dolphin管理大型项目时可以复用这个结构去创建更多的子项目.

    ├── api
    │   ├── app.auto.go
    │   ├── app.go
    │   └── article.go
    ├── app.properties
    ├── doc
    │   └── swagger.yaml
    ├── Dockerfile
    ├── go.mod
    ├── go.sum
    ├── k8s
    │   ├── configmap.yaml
    │   ├── deployment.yaml
    │   ├── Dockerfile
    │   ├── ingress.yaml
    │   ├── service.yaml
    │   ├── start.sh
    │   └── tls.yaml
    ├── log
    │   └── hello.2021070700
    ├── 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
    │   ├── cache.go
    │   ├── db.go
    │   ├── http.go
    │   └── svc.go
    ├── 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