522 lines
16 KiB
Go
522 lines
16 KiB
Go
// 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}}",
|
|
"contact": {},
|
|
"version": "{{.Version}}"
|
|
},
|
|
"host": "{{.Host}}",
|
|
"basePath": "{{.BasePath}}",
|
|
"paths": {
|
|
"/people": {
|
|
"get": {
|
|
"description": "此接口用来获取人员数据列表,支持名称模糊查询,以及自定义排序(name, created_at)",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"people"
|
|
],
|
|
"summary": "人员列表",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "页码",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "每页数量",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"type": "string",
|
|
"description": "名称",
|
|
"name": "name",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "排序字段",
|
|
"name": "sort_by",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "排序类型",
|
|
"name": "sort_direction",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Person"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"people"
|
|
],
|
|
"summary": "新增一条人员数据",
|
|
"parameters": [
|
|
{
|
|
"maxLength": 100,
|
|
"minLength": 1,
|
|
"type": "string",
|
|
"description": "名称",
|
|
"name": "name",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "个性签名",
|
|
"name": "signature",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Person"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/people/{id}": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"people"
|
|
],
|
|
"summary": "获取单个人员",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Person"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"people"
|
|
],
|
|
"summary": "删除一条人员数据",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Person"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"people"
|
|
],
|
|
"summary": "修改人员数据",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"type": "string",
|
|
"description": "名称",
|
|
"name": "name",
|
|
"in": "formData"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "个性签名",
|
|
"name": "signature",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Person"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/templates": {
|
|
"get": {
|
|
"description": "一段描述",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"templates"
|
|
],
|
|
"summary": "数据列表",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "页码",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "每页数量",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"type": "string",
|
|
"description": "名称搜索",
|
|
"name": "name",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "uuid搜索",
|
|
"name": "uuid",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "排序字段",
|
|
"name": "sort_by",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "排序类型",
|
|
"name": "sort_direction",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Template"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"templates"
|
|
],
|
|
"summary": "新增一条模板数据",
|
|
"parameters": [
|
|
{
|
|
"maxLength": 100,
|
|
"minLength": 1,
|
|
"type": "string",
|
|
"description": "名称",
|
|
"name": "name",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "uuid",
|
|
"name": "uuid",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Template"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/templates/{id}": {
|
|
"get": {
|
|
"description": "这是一段描述",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"templates"
|
|
],
|
|
"summary": "获取单个模板",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Template"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"templates"
|
|
],
|
|
"summary": "删除一条数据",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Template"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"templates"
|
|
],
|
|
"summary": "修改模板数据",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"minLength": 1,
|
|
"type": "string",
|
|
"description": "名称",
|
|
"name": "name",
|
|
"in": "formData"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "uuid",
|
|
"name": "uuid",
|
|
"in": "formData"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Template"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"model.Person": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"followed_count": {
|
|
"description": "关注数",
|
|
"type": "integer"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"name": {
|
|
"description": "名称",
|
|
"type": "string"
|
|
},
|
|
"signature": {
|
|
"description": "个性签名",
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.Template": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"uuid": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}`
|
|
|
|
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: "/api",
|
|
Schemes: []string{},
|
|
Title: "ShareKnowledgeServer Api",
|
|
Description: "知识共享平台",
|
|
}
|
|
|
|
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{})
|
|
}
|