Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FrameworkRegistory = map[string]FrameworkConfig{ "gin": { Name: "gin", Imports: `"github.com/gin-gonic/gin"`, ContextName: "c", ContextType: "*gin.Context", Bind: "c.BindJSON", JSON: "c.JSON", Router: "*gin.Engine", Start: "gin.Default()", OtherImports: `"net/http"`, FullContext: "c *gin.Context", IsAPIGroup: true, ApiGroup: func(entity string, get string, lowerentity string) string { apiGroup := fmt.Sprintf(` { %s := api.Group("/%s") { %s.%s("", %sHandler.Get%ss) } } `, lowerentity, lowerentity, lowerentity, get, lowerentity, entity) return apiGroup }, Get: "GET", ToTheClient: "c.JSON(http.StatusOK, ", Response: "(http.StatusOK,", ImportRouter: ` "net/http" "github.com/gin-gonic/gin" `, ImportHandler: ` "github.com/gin-gonic/gin" "net/http" `, Returnable: "", ReturnKeyword: "", HTTPHandler: "http.Handler", }, "chi": { Name: "chi", Imports: `"github.com/go-chi/chi/v5"`, ContextName: "r", ContextType: "http.ResponseWriter, *http.Request", Bind: "json.NewDecoder(r.Body).Decode", JSON: "render.JSON", Router: "chi.Router", Start: "chi.NewRouter()", OtherImports: ` "encoding/json" "github.com/go-chi/render" "net/http" `, IsAPIGroup: false, ApiGroup: func(entity string, get string, lowerentity string) string { apiGroup := fmt.Sprintf(` r.Group(func(r chi.Router) { r.%s("/%s", %sHandler.Get%ss) }) `, get, lowerentity, lowerentity, entity) return apiGroup }, Get: "Get", FullContext: "w http.ResponseWriter, r *http.Request", ToTheClient: "render.JSON(w,r,", Response: "(w, r,", ImportRouter: ` "encoding/json" "net/http" "github.com/go-chi/chi/v5" `, ImportHandler: ` "net/http" "github.com/go-chi/render" `, Returnable: "", ReturnKeyword: "", HTTPHandler: "http.Handler", }, "echo": { Name: "echo", Imports: `"github.com/labstack/echo/v4"`, ContextName: "c", ContextType: "echo.Context", Bind: "c.Bind", JSON: "c.JSON", Router: "*echo.Echo", Start: "echo.New()", OtherImports: `"net/http"`, IsAPIGroup: true, ApiGroup: func(entity, get, lowerentity string) string { return fmt.Sprintf(` { %s := api.Group("/%s") { %s.%s("", %sHandler.Get%ss) } } `, lowerentity, lowerentity, lowerentity, get, lowerentity, entity) }, Get: "GET", FullContext: "c echo.Context", ToTheClient: "c.JSON(http.StatusOK, ", Response: "(http.StatusOK,", ImportRouter: ` "net/http" "github.com/labstack/echo/v4" `, ImportHandler: ` "net/http" "github.com/labstack/echo/v4" `, Returnable: "error", ReturnKeyword: "return", HTTPHandler: "http.Handler", }, "fiber": { Name: "fiber", Imports: `"github.com/gofiber/fiber/v2"`, ContextName: "c", ContextType: "*fiber.Ctx", Bind: "c.BodyParser", JSON: "c.JSON", Router: "*fiber.App", Start: "fiber.New()", OtherImports: `"net/http"`, IsAPIGroup: true, ApiGroup: func(entity, get, lowerentity string) string { return fmt.Sprintf(` api := r.Group("/api/v1") { %s := api.Group("/%s") { %s.%s("", %sHandler.Get%ss) } } `, lowerentity, lowerentity, lowerentity, get, lowerentity, entity) }, Get: "Get", FullContext: "c *fiber.Ctx", ToTheClient: "c.JSON(", Response: "(fiber.StatusOK,", ImportRouter: ` "github.com/gofiber/fiber/v2" `, ImportHandler: ` "github.com/gofiber/fiber/v2" `, Returnable: "error", ReturnKeyword: "return", HTTPHandler: "*fiber.App", }, "mux": { Name: "mux", Imports: `"github.com/gorilla/mux"`, ContextName: "w, r", ContextType: "http.ResponseWriter, *http.Request", Bind: "json.NewDecoder(r.Body).Decode", JSON: `json.NewEncoder(w).Encode`, Router: "*mux.Router", Start: "mux.NewRouter()", OtherImports: ` "encoding/json" "net/http" `, }, }
Functions ¶
This section is empty.
Types ¶
type FrameworkConfig ¶
type FrameworkConfig struct {
Name string
Imports string
Entity string
ContextName string
ContextType string
Bind string
JSON string
Router string
Start string
OtherImports string
ApiGroup func(entity string, get string, lowerentity string) string
Get string
FullContext string
ToTheClient string
Response string
ImportRouter string
ImportHandler string
Returnable string
ReturnKeyword string
HTTPHandler string
Entities []string
IsAPIGroup bool
}
Click to show internal directories.
Click to hide internal directories.