replace 4-space with tabs in go templates

This commit is contained in:
William Cheng 2024-02-08 12:58:19 +08:00
parent fdb001c8a3
commit 0d1b14a75f
2 changed files with 36 additions and 36 deletions

View File

@ -26,25 +26,25 @@ func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine {
// NewRouter add routes to existing gin engine. // NewRouter add routes to existing gin engine.
func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine { func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
for _, route := range getRoutes(handleFunctions) { for _, route := range getRoutes(handleFunctions) {
if route.HandlerFunc == nil { if route.HandlerFunc == nil {
route.HandlerFunc = DefaultHandleFunc route.HandlerFunc = DefaultHandleFunc
} }
switch route.Method { switch route.Method {
case http.MethodGet: case http.MethodGet:
router.GET(route.Pattern, route.HandlerFunc) router.GET(route.Pattern, route.HandlerFunc)
case http.MethodPost: case http.MethodPost:
router.POST(route.Pattern, route.HandlerFunc) router.POST(route.Pattern, route.HandlerFunc)
case http.MethodPut: case http.MethodPut:
router.PUT(route.Pattern, route.HandlerFunc) router.PUT(route.Pattern, route.HandlerFunc)
case http.MethodPatch: case http.MethodPatch:
router.PATCH(route.Pattern, route.HandlerFunc) router.PATCH(route.Pattern, route.HandlerFunc)
case http.MethodDelete: case http.MethodDelete:
router.DELETE(route.Pattern, route.HandlerFunc) router.DELETE(route.Pattern, route.HandlerFunc)
} }
} }
return router return router
} }
// Default handler for not yet implemented routes // Default handler for not yet implemented routes

View File

@ -34,25 +34,25 @@ func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine {
// NewRouter add routes to existing gin engine. // NewRouter add routes to existing gin engine.
func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine { func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
for _, route := range getRoutes(handleFunctions) { for _, route := range getRoutes(handleFunctions) {
if route.HandlerFunc == nil { if route.HandlerFunc == nil {
route.HandlerFunc = DefaultHandleFunc route.HandlerFunc = DefaultHandleFunc
} }
switch route.Method { switch route.Method {
case http.MethodGet: case http.MethodGet:
router.GET(route.Pattern, route.HandlerFunc) router.GET(route.Pattern, route.HandlerFunc)
case http.MethodPost: case http.MethodPost:
router.POST(route.Pattern, route.HandlerFunc) router.POST(route.Pattern, route.HandlerFunc)
case http.MethodPut: case http.MethodPut:
router.PUT(route.Pattern, route.HandlerFunc) router.PUT(route.Pattern, route.HandlerFunc)
case http.MethodPatch: case http.MethodPatch:
router.PATCH(route.Pattern, route.HandlerFunc) router.PATCH(route.Pattern, route.HandlerFunc)
case http.MethodDelete: case http.MethodDelete:
router.DELETE(route.Pattern, route.HandlerFunc) router.DELETE(route.Pattern, route.HandlerFunc)
} }
} }
return router return router
} }
// Default handler for not yet implemented routes // Default handler for not yet implemented routes