docs.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
  2. // This file was generated by swaggo/swag
  3. package docs
  4. import (
  5. "bytes"
  6. "encoding/json"
  7. "strings"
  8. "text/template"
  9. "github.com/swaggo/swag"
  10. )
  11. var doc = `{
  12. "schemes": {{ marshal .Schemes }},
  13. "swagger": "2.0",
  14. "info": {
  15. "description": "{{escape .Description}}",
  16. "title": "{{.Title}}",
  17. "termsOfService": "https://www.hzinsights.com/",
  18. "contact": {
  19. "name": "www.hzinsights.com/",
  20. "url": "https://www.hzinsights.com/",
  21. "email": "pyan@hzinsights.com"
  22. },
  23. "license": {
  24. "name": "Apache 2.0",
  25. "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
  26. },
  27. "version": "{{.Version}}"
  28. },
  29. "host": "{{.Host}}",
  30. "basePath": "{{.BasePath}}",
  31. "paths": {}
  32. }`
  33. type swaggerInfo struct {
  34. Version string
  35. Host string
  36. BasePath string
  37. Schemes []string
  38. Title string
  39. Description string
  40. }
  41. // SwaggerInfo holds exported Swagger Info so clients can modify it
  42. var SwaggerInfo = swaggerInfo{
  43. Version: "1.0",
  44. Host: "127.0.0.1:8607",
  45. BasePath: "/",
  46. Schemes: []string{},
  47. Title: "弘则人力资源管理系统API接口文档",
  48. Description: "弘则人力资源管理系统API接口文档",
  49. }
  50. type s struct{}
  51. func (s *s) ReadDoc() string {
  52. sInfo := SwaggerInfo
  53. sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
  54. t, err := template.New("swagger_info").Funcs(template.FuncMap{
  55. "marshal": func(v interface{}) string {
  56. a, _ := json.Marshal(v)
  57. return string(a)
  58. },
  59. "escape": func(v interface{}) string {
  60. // escape tabs
  61. str := strings.Replace(v.(string), "\t", "\\t", -1)
  62. // replace " with \", and if that results in \\", replace that with \\\"
  63. str = strings.Replace(str, "\"", "\\\"", -1)
  64. return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
  65. },
  66. }).Parse(doc)
  67. if err != nil {
  68. return doc
  69. }
  70. var tpl bytes.Buffer
  71. if err := t.Execute(&tpl, sInfo); err != nil {
  72. return doc
  73. }
  74. return tpl.String()
  75. }
  76. func init() {
  77. swag.Register("swagger", &s{})
  78. }