导出文档排序
This commit is contained in:
谢小军
2020-06-09 12:06:07 +08:00
parent 55cb9aa09e
commit 64cf55ca76
6 changed files with 84 additions and 5 deletions

Binary file not shown.

View File

@@ -10,6 +10,41 @@
#### 简要描述:
- []
#### 请求URL:
- http://localhost/xxjwxc/api/appuser/userlist
#### 请求方式:
- POST
#### 请求参数:
#### 请求示例:
```
{}
```
#### 返回参数说明:
#### 返回示例:
```
{}
```
#### 备注:
-
--------------------
#### 简要描述:
- [...]
#### 请求URL:

View File

@@ -96,6 +96,45 @@
}
}
},
"/xxjwxc/api/appuser/userlist": {
"post": {
"tags": [
"Hello"
],
"summary": "",
"description": "",
"consumes": [
"application/json",
"application/xml"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "",
"required": true,
"schema": {
"$ref": "#/definitions/ReqTest1"
}
}
],
"responses": {
"400": {
"description": "v"
},
"404": {
"description": "not found"
},
"405": {
"description": "Validation exception"
}
}
}
},
"/xxjwxc/block": {
"get": {
"tags": [

9
gen.go
View File

@@ -71,12 +71,14 @@ func genOutPut(outDir, modFile string) {
_mu.Lock()
defer _mu.Unlock()
genCode(outDir, modFile) // gen .go file
b := genCode(outDir, modFile) // gen .go file
_genInfo.Tm = time.Now().Unix()
_data, _ := serializing.Encode(&_genInfo) // gob serialize 序列化
_path := path.Join(tools.GetCurrentDirectory(), getRouter)
if !b {
tools.BuildDir(_path)
}
f, err := os.Create(_path)
if err != nil {
return
@@ -85,7 +87,7 @@ func genOutPut(outDir, modFile string) {
f.Write(_data)
}
func genCode(outDir, modFile string) {
func genCode(outDir, modFile string) bool {
_genInfo.Tm = time.Now().Unix()
if len(outDir) == 0 {
outDir = modFile + "/routers/"
@@ -107,13 +109,14 @@ func genCode(outDir, modFile string) {
tmpl.Execute(&buf, data)
f, err := os.Create(outDir + "gen_router.go")
if err != nil {
return
return false
}
defer f.Close()
f.Write(buf.Bytes())
// format
exec.Command("gofmt", "-l", "-w", outDir).Output()
return true
}
func getPkgName(dir string) string {

2
go.mod
View File

@@ -5,7 +5,7 @@ go 1.12
require (
github.com/gin-gonic/gin v1.6.3
github.com/go-playground/validator/v10 v10.2.0
github.com/xxjwxc/public v0.0.0-20200605161710-72fc28675475
github.com/xxjwxc/public v0.0.0-20200609035341-fcc9bd7f7bd9
)
// replace github.com/xxjwxc/public => ../public

2
go.sum
View File

@@ -176,6 +176,8 @@ github.com/xxjwxc/public v0.0.0-20200603115833-341beff27850 h1:UCW8LJHTCOlkQt1+K
github.com/xxjwxc/public v0.0.0-20200603115833-341beff27850/go.mod h1:fp3M+FEQrCgWD1fZ/PLwZkCTglf086OEhC9LcydAUnc=
github.com/xxjwxc/public v0.0.0-20200605161710-72fc28675475 h1:VDny2T9+fQwq9WZkwrnD7hfANzX5lUOx53l31NPA9T8=
github.com/xxjwxc/public v0.0.0-20200605161710-72fc28675475/go.mod h1:0BFWVHqt7nKW8MtIx7R7bOkoGQFFnKsaJeeVbkzY88E=
github.com/xxjwxc/public v0.0.0-20200609035341-fcc9bd7f7bd9 h1:oL1xR37Vm5irXTXHSilRYvlPiSZ6nkk+ja+wwsNxZ8E=
github.com/xxjwxc/public v0.0.0-20200609035341-fcc9bd7f7bd9/go.mod h1:0BFWVHqt7nKW8MtIx7R7bOkoGQFFnKsaJeeVbkzY88E=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=