重构 #4
							
								
								
									
										20
									
								
								docs/docs.go
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								docs/docs.go
									
									
									
									
									
								
							| @@ -9,15 +9,7 @@ const docTemplate = `{ | |||||||
|     "info": { |     "info": { | ||||||
|         "description": "{{escape .Description}}", |         "description": "{{escape .Description}}", | ||||||
|         "title": "{{.Title}}", |         "title": "{{.Title}}", | ||||||
|         "contact": { |         "contact": {}, | ||||||
|             "name": "Divano", |  | ||||||
|             "url": "http://www.example.com", |  | ||||||
|             "email": "divano@example.com" |  | ||||||
|         }, |  | ||||||
|         "license": { |  | ||||||
|             "name": "Apache 2.0", |  | ||||||
|             "url": "http://www.apache.org/licenses/LICENSE-2.0.html" |  | ||||||
|         }, |  | ||||||
|         "version": "{{.Version}}" |         "version": "{{.Version}}" | ||||||
|     }, |     }, | ||||||
|     "host": "{{.Host}}", |     "host": "{{.Host}}", | ||||||
| @@ -423,12 +415,12 @@ const docTemplate = `{ | |||||||
|  |  | ||||||
| // SwaggerInfo holds exported Swagger Info so clients can modify it | // SwaggerInfo holds exported Swagger Info so clients can modify it | ||||||
| var SwaggerInfo = &swag.Spec{ | var SwaggerInfo = &swag.Spec{ | ||||||
| 	Version:          "1.0", | 	Version:          "", | ||||||
| 	Host:             "localhost:8086", | 	Host:             "", | ||||||
| 	BasePath:         "/api/v1", | 	BasePath:         "", | ||||||
| 	Schemes:          []string{}, | 	Schemes:          []string{}, | ||||||
| 	Title:            "猪场管理系统 API", | 	Title:            "", | ||||||
| 	Description:      "这是一个用于管理猪场设备的后端服务。", | 	Description:      "", | ||||||
| 	InfoInstanceName: "swagger", | 	InfoInstanceName: "swagger", | ||||||
| 	SwaggerTemplate:  docTemplate, | 	SwaggerTemplate:  docTemplate, | ||||||
| 	LeftDelim:        "{{", | 	LeftDelim:        "{{", | ||||||
|   | |||||||
| @@ -1,21 +1,8 @@ | |||||||
| { | { | ||||||
|     "swagger": "2.0", |     "swagger": "2.0", | ||||||
|     "info": { |     "info": { | ||||||
|         "description": "这是一个用于管理猪场设备的后端服务。", |         "contact": {} | ||||||
|         "title": "猪场管理系统 API", |  | ||||||
|         "contact": { |  | ||||||
|             "name": "Divano", |  | ||||||
|             "url": "http://www.example.com", |  | ||||||
|             "email": "divano@example.com" |  | ||||||
|         }, |  | ||||||
|         "license": { |  | ||||||
|             "name": "Apache 2.0", |  | ||||||
|             "url": "http://www.apache.org/licenses/LICENSE-2.0.html" |  | ||||||
|         }, |  | ||||||
|         "version": "1.0" |  | ||||||
|     }, |     }, | ||||||
|     "host": "localhost:8086", |  | ||||||
|     "basePath": "/api/v1", |  | ||||||
|     "paths": { |     "paths": { | ||||||
|         "/devices": { |         "/devices": { | ||||||
|             "get": { |             "get": { | ||||||
|   | |||||||
| @@ -1,4 +1,3 @@ | |||||||
| basePath: /api/v1 |  | ||||||
| definitions: | definitions: | ||||||
|   controller.Properties: |   controller.Properties: | ||||||
|     type: object |     type: object | ||||||
| @@ -126,18 +125,8 @@ definitions: | |||||||
|         example: testuser |         example: testuser | ||||||
|         type: string |         type: string | ||||||
|     type: object |     type: object | ||||||
| host: localhost:8086 |  | ||||||
| info: | info: | ||||||
|   contact: |   contact: {} | ||||||
|     email: divano@example.com |  | ||||||
|     name: Divano |  | ||||||
|     url: http://www.example.com |  | ||||||
|   description: 这是一个用于管理猪场设备的后端服务。 |  | ||||||
|   license: |  | ||||||
|     name: Apache 2.0 |  | ||||||
|     url: http://www.apache.org/licenses/LICENSE-2.0.html |  | ||||||
|   title: 猪场管理系统 API |  | ||||||
|   version: "1.0" |  | ||||||
| paths: | paths: | ||||||
|   /devices: |   /devices: | ||||||
|     get: |     get: | ||||||
|   | |||||||
| @@ -1,5 +1,15 @@ | |||||||
| package api | package api | ||||||
|  |  | ||||||
|  | // @title 猪场管理系统 API | ||||||
|  | // @version 1.0 | ||||||
|  | // @description 这是一个用于管理猪场设备的后端服务。 | ||||||
|  | // @contact.name Divano | ||||||
|  | // @contact.url http://www.example.com | ||||||
|  | // @contact.email divano@example.com | ||||||
|  | // @license.name Apache 2.0 | ||||||
|  | // @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||||||
|  | // @host localhost:8086 | ||||||
|  | // @BasePath /api/v1 | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.go
									
									
									
									
									
								
							| @@ -7,16 +7,6 @@ import ( | |||||||
| 	"git.huangwc.com/pig/pig-farm-controller/internal/core" | 	"git.huangwc.com/pig/pig-farm-controller/internal/core" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // @title 猪场管理系统 API |  | ||||||
| // @version 1.0 |  | ||||||
| // @description 这是一个用于管理猪场设备的后端服务。 |  | ||||||
| // @contact.name Divano |  | ||||||
| // @contact.url http://www.example.com |  | ||||||
| // @contact.email divano@example.com |  | ||||||
| // @license.name Apache 2.0 |  | ||||||
| // @license.url http://www.apache.org/licenses/LICENSE-2.0.html |  | ||||||
| // @host localhost:8086 |  | ||||||
| // @BasePath /api/v1 |  | ||||||
| func main() { | func main() { | ||||||
| 	// 1. 创建应用实例 | 	// 1. 创建应用实例 | ||||||
| 	// 所有复杂的初始化逻辑都已封装在 NewApplication 中 | 	// 所有复杂的初始化逻辑都已封装在 NewApplication 中 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user