Directory Structure
.
├── etc
├── cmd
├── queue
├── generate
├── initialize
├── go.mod
├── internal
│ ├── config
│ ├── handler
│ ├── middleware
│ ├── logic
│ ├── svc
│ ├── types
│ └── model
├── scheduler
├── pkg
└── script
- apis: API definition files
- etc: Directory for static configuration files
- cmd:Application entry point
- queue:Queue consumption service
- generate:Code generation tools
- initialize: Initialization system configuration
- internal:Internal modules
- config:Configuration file parsing
- handler:HTTP interface handling, with
handleras the fixed suffix - middleware:HTTP middleware
- logic:Business logic handling, with
logicas the fixed suffix - svc:Service layer encapsulation
- types:Type definitions
- model:Data models
- scheduler:Scheduled tasks
- pkg: Common utility code
- script:Build scripts
Generate Code
$ chmod +x script/generate.sh
$ ./script/generate.sh
Generate Swagger
$ goctl api plugin -plugin goctl-swagger='swagger -filename ppanel.json -pack Response -response "[{\"name\":\"code\",\"type\":\"integer\",\"description\":\"状态码\"},{\"name\":\"msg\",\"type\":\"string\",\"description\":\"消息\"},{\"name\":\"data\",\"type\":\"object\",\"description\":\"数据\",\"is_data\":true}]";' -api ppanel.api -dir .
Format API File
$ goctl api format --dir api/user.api
Build
$ go build -o ppanel ppanel.go
Run
$ ./ppanel run --config etc/ppanel.yaml
Languages
Go
93.7%
PLpgSQL
4.1%
HTML
1.6%
Shell
0.3%
Makefile
0.1%