コードジェネレートとの付き合い方 @Go Conference 2018 Spring

Description
1. Go Conference 2018 Spring @pei0804 2. ã twitter/github @pei0804 ã Hatena tikasan ã VOYAGE GROUP
 2018 ã OSS
 swaggo: GoDoc Swagger 3. ã ã ã 4. 
 5.…

Please download to get full document.

View again

of 144
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information
Category:

Technology

Publish on:

Views: 2 | Pages: 144

Extension: PDF | Download: 0

Share
Transcript
  • 1. Go Conference 2018 Spring @pei0804
  • 2. • twitter/github @pei0804 • Hatena tikasan • VOYAGE GROUP
 2018 • OSS
 swaggo: GoDoc Swagger
  • 3. • • •
  • 4. 

  • 5. 

  • 6. database/sql Scan
  • 7. github.com/variadico/scaneo
  • 8. $ scaneo hoge.go
 scans.go
  • 9. Scan 

  • 10. github.com/variadico/scaneo
  • 11. • 
 func ScanCategory
 func ScanCategories • 
 func ScanCategory
 func ScanCategorys
  • 12. 
 Category 
 Categorys
  • 13. 

  • 14. tmpl.go 
 PR
  • 15. OSS
  • 16. 
 Fork
  • 17. Fork 
 &&
 

  • 18. OSS 

  • 19. 

  • 20. github.com/swaggo/swag
  • 21. github.com/swaggo/swag Go 
 Swagger Swagger API 
 ※Go
  • 22. Getting started
  • 23. $ go get -u github.com/swaggo/swag/cmd/swag
  • 24. API
  • 25. $ swag init
  • 26. docs/swagger/swagger.json
  • 27. Swagger UI 
 swaggo Middleware
  • 28. http://localhost:8080/swagger/index.html
  • 29. 
 

  • 30. • • • API • • Swagger spec
  • 31. • • • API • • Swagger spec
  • 32. 
 ※ • @title • @version • @basepath URI • @host •
  • 33. parser.go
  • 34. parser.go
  • 35. AST go/parser • : abstract syntax tree AST 
 wikipedia
  • 36. • Go AST Hello, World #golang
 https://qiita.com/tenntenn/items/ 0cbc6f1f00dc579fcd8c • Go Go
 https://motemen.github.io/go-for-go-book/
  • 37. ParseFile • Go • 
 fset *token.FileSet, filename string, src interface{}, mode Mode • 
 *ast.File, error
  • 38. ast.File
  • 39. ast.File
  • 40. parser.go
  • 41. • • • API • • Swagger spec
  • 42. API ( )
 ※ • @param • @success • @failure • @router • @accept, @produce MimeType
  • 43. parser.go
  • 44. parser.go
  • 45. parser.go
  • 46. parser.go
  • 47. parser.go
  • 48. parser.go
  • 49. parser.go
  • 50. OK

  • 51. 
 // @Success 200 {array} model.Account "User"
 @Success {param } 

  • 52. α 
 

  • 53. 

  • 54. 
 // @Param default query string false "string default" default(A) Swagger
  • 55. 
 // @Param default query string false "string default" Enums(A, B ,C) default(A) 
 

  • 56. 🤔
  • 57. // @Param default query string false "string default" Enums(A, B ,C) default(A) // @Param default query string false "string default" Enums(A, B ,C) default(A)
  • 58. 
 
 😇
  • 59. Model
  • 60. @Param account body model.Account ~~ model Account 
 
 Model
  • 61. AST TypeDefinitions map[string]map[string]*ast.TypeSpec
 map[ ][ ] AST model 
 
 
 TypeDefinitions["model"]["Account"] model Account AST 

  • 62. • • •
  • 63. • • •
  • 64. parser.go
  • 65. parser.go
  • 66. parser.go
  • 67. parser.go
  • 68. parser.go
  • 69. • • •
  • 70. parser.go
  • 71. parser.go
  • 72. 
 

  • 73. 
 
 😇
  • 74. User Family User Family User Family User Family User panic
  • 75. • • •
  • 76. 🤔
  • 77. • 
 
 • •
  • 78. parser.go
  • 79. parser.go
  • 80. User Family User Family User Family User Family User panic
  • 81. User Family User Family User Family User Family User panic
  • 82. 😂
  • 83. • • • API • • Swagger spec
  • 84. github.com/go-openapi/spec
  • 85. github.com/go-openapi/spec Swagger2.0 spec 
 go-swagger/go-swagger 
 Swagger
  • 86. 3.0 
 github.com/go-openapi/spec3
  • 87. 
 Swagger 

  • 88. 

  • 89. • 
 • 

  • 90. •
  • 91. 

  • 92. 
 
 
 OSS swaggo welcome
  • 93. • github.com/mercari/go-httpdoc
 • github.com/goadesign/goa
 DSL Swagger • github.com/cheekybits/genny
 Go
  • 94. • Go 
 https://www.slideshare.net/lestrrat/go-86436442 • go generate go/ast 
 https://speakerdeck.com/masashisalvador57f/ast-falsezatukuritositahua • go generate 
 http://agtn.hatenablog.com/entry/2017/08/06/015813
  • Related Search
    We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks