-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.go
50 lines (42 loc) · 1 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"strings"
"github.com/5bug/ginhelper/templates"
)
// APIRequest api request
type APIRequest struct {
Group string
Name string
Comment string
Route string
Method string
Auth bool
}
// RequestMap define RequestMap
type RequestMap map[string][]APIRequest
// Requests request list
func (m RequestMap) Requests() (list []APIRequest) {
for _, requests := range m {
list = append(list, requests...)
}
return
}
// App ...
type App struct {
Project string //工程名称
Name string //app名
Service string //服务名(首字母大写)
RootDir string //项目根目录
APIDir string //api目录
}
// RenderValue render data
type RenderValue struct {
App App
Requests []APIRequest
}
var appfiles = map[string]string{
"cmd/%s/main.go": templates.MainTpl,
"internal/%s/conf/conf.go": templates.ConfTpl,
"internal/%s/api/api.go": strings.ReplaceAll(templates.APITpl, "[*]", "`"),
"internal/%s/service/service.go": templates.ServiceTpl,
}