gin-blog/docs/docs.go

423 lines
13 KiB
Go
Raw Normal View History

2021-05-28 10:40:39 +00:00
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"termsOfService": "https://github.com/go-programming-tour-book",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/tags": {
"get": {
"produces": [
"application/json"
],
"summary": "获取多个标签",
"parameters": [
{
"maxLength": 100,
"type": "string",
"description": "标签名称",
"name": "name",
"in": "query"
},
{
"enum": [
0,
1
],
"type": "integer",
"default": 1,
"description": "状态",
"name": "state",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "每页数量",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/model.TagSwagger"
}
},
"400": {
"description": "请求错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"summary": "新增标签",
"parameters": [
{
"maxLength": 100,
"minLength": 3,
"type": "string",
"description": "标签名称",
"name": "name",
"in": "formData",
"required": true
},
{
"enum": [
0,
1
],
"type": "integer",
"default": 1,
"description": "状态",
"name": "state",
"in": "formData"
},
{
"maxLength": 100,
"minLength": 3,
"type": "string",
"description": "创建者",
"name": "created_by",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/model.TagSwagger"
}
},
"400": {
"description": "请求错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
}
}
}
},
"/api/v1/tags/{id}": {
"put": {
"produces": [
"application/json"
],
"summary": "更新标签",
"parameters": [
{
"type": "integer",
"description": "标签 ID",
"name": "id",
"in": "path",
"required": true
},
{
"minLength": 3,
"type": "string",
"description": "标签名称",
"name": "name",
"in": "formData"
},
{
"enum": [
0,
1
],
"type": "integer",
"default": 1,
"description": "状态",
"name": "state",
"in": "formData"
},
{
"maxLength": 100,
"minLength": 3,
"type": "string",
"description": "修改者",
"name": "modified_by",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.TagSwagger"
}
}
},
"400": {
"description": "请求错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"summary": "删除标签",
"parameters": [
{
"type": "integer",
"description": "标签 ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"type": "string"
}
},
"400": {
"description": "请求错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
}
}
}
},
"/upload/file": {
"post": {
"produces": [
"application/json"
],
"summary": "上传图片",
"parameters": [
{
"enum": [
1,
2,
3
],
"type": "integer",
"description": "文件类型1图片",
"name": "type",
"in": "formData",
"required": true
},
{
"type": "file",
"description": "文件",
"name": "state",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/service.FileInfo"
}
},
"400": {
"description": "请求错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/errorcode.Error"
}
}
}
}
}
},
"definitions": {
"app.Pager": {
"type": "object",
"properties": {
"page": {
"type": "integer"
},
"page_size": {
"type": "integer"
},
"total_rows": {
"type": "integer"
}
}
},
"errorcode.Error": {
"type": "object"
},
"model.Tag": {
"type": "object",
"properties": {
"created_by": {
"type": "string"
},
"created_on": {
"type": "integer"
},
"deleted_on": {
"type": "integer"
},
"id": {
"type": "integer"
},
"is_del": {
"type": "integer"
},
"modified_by": {
"type": "string"
},
"modified_on": {
"type": "integer"
},
"name": {
"type": "string"
},
"state": {
"type": "integer"
}
}
},
"model.TagSwagger": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Tag"
}
},
"pager": {
"$ref": "#/definitions/app.Pager"
}
}
},
"service.FileInfo": {
"type": "object",
"properties": {
"accessUrl": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
}`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "博客系统",
Description: "Go 语言编程之旅:一起用 Go 做项目",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
}
func init() {
swag.Register(swag.Name, &s{})
}