Documentation ¶
Index ¶
- func AddChiHandlers(r *chi.Mux, d *sql.DB, l *logrus.Logger, v *validator.Validate, ...) *chi.Mux
- func AddEchoHandlers(r *echo.Echo, d *sql.DB, l *logrus.Logger, v *validator.Validate, ...) *echo.Echo
- func AddFiberHandlers(r *fiber.App, d *sql.DB, l *logrus.Logger, v *validator.Validate, ...) *fiber.App
- func AddGinHandlers(r *gin.Engine, d *sql.DB, l *logrus.Logger, v *validator.Validate, ...) *gin.Engine
- func AddGorillaMuxHandlers(r *mux.Router, d *sql.DB, l *logrus.Logger, v *validator.Validate, ...) *mux.Router
- func AddHandlers(d *sql.DB, l *logrus.Logger, v *validator.Validate, h AddRouteFunctions, ...)
- func ChiHandlerWrapper(h http.HandlerFunc) http.HandlerFunc
- func EchoHandlerWrapper(h http.HandlerFunc) echo.HandlerFunc
- func FiberHandlerWrapper(h http.HandlerFunc) fiber.Handler
- func GinHandlerWrapper(h http.HandlerFunc) gin.HandlerFunc
- func GorillaHandlerWrapper(mid func(h http.Handler) http.HandlerFunc, h http.HandlerFunc) http.HandlerFunc
- type AddParamFunc
- type AddRouteFunc
- func ChiAddRouteFunc(f AddRouteFunc) AddRouteFunc
- func EchoAddRouteFunc(f EchoAddRouteType) AddRouteFunc
- func FiberAddRouteFunc(f FiberAddRouteType) AddRouteFunc
- func GinAddRouteFunc(f GinAddRouteType) AddRouteFunc
- func GorillaAddRouteFunc(r *mux.Router, mid func(h http.Handler) http.HandlerFunc, method string) AddRouteFunc
- type AddRouteFunctions
- type EchoAddRouteType
- type FiberAddRouteType
- type GinAddRouteType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddChiHandlers ¶ added in v1.2.1
func AddEchoHandlers ¶ added in v1.2.1
func AddFiberHandlers ¶ added in v1.2.1
func AddGinHandlers ¶ added in v1.1.0
func AddGorillaMuxHandlers ¶ added in v1.1.0
func AddHandlers ¶
func AddHandlers(d *sql.DB, l *logrus.Logger, v *validator.Validate, h AddRouteFunctions, apf AddParamFunc, resources []resource.Resource)
AddHandlers adds the routes to the router
func ChiHandlerWrapper ¶ added in v1.3.1
func ChiHandlerWrapper(h http.HandlerFunc) http.HandlerFunc
ChiHandlerWrapper wraps the handler function. It adds params to request context.
func EchoHandlerWrapper ¶ added in v1.3.1
func EchoHandlerWrapper(h http.HandlerFunc) echo.HandlerFunc
EchoHandlerWrapper converts a http.HandlerFunc to a echo.HandlerFunc It adds params to request context.
func FiberHandlerWrapper ¶ added in v1.3.1
func FiberHandlerWrapper(h http.HandlerFunc) fiber.Handler
FiberHandlerWrapper wraps the handler function to a fiber handler. It adds params to request context.
func GinHandlerWrapper ¶ added in v1.3.1
func GinHandlerWrapper(h http.HandlerFunc) gin.HandlerFunc
GinHandlerWrapper converts a http.HandlerFunc to a gin.HandlerFunc It adds params to request context.
func GorillaHandlerWrapper ¶ added in v1.3.1
func GorillaHandlerWrapper(mid func(h http.Handler) http.HandlerFunc, h http.HandlerFunc) http.HandlerFunc
GorillaHandlerWrapper wraps the handler function. It adds params to request context. If the middelware function is nil, it returns the handler
Types ¶
type AddParamFunc ¶ added in v1.3.1
AddParamFunc is a function that adds a param to a url/endpoint. It should return the route with the param added. Example: /users + id -> /users/:id Each router/framework should implement this function.
type AddRouteFunc ¶ added in v1.3.1
type AddRouteFunc func(name string, h http.HandlerFunc)
AddRouteFunc is type of a function that adds a route to a router, with a given name and handler. It should also add the params to the handler. Each router/framework should implement this function.
func ChiAddRouteFunc ¶ added in v1.3.1
func ChiAddRouteFunc(f AddRouteFunc) AddRouteFunc
ChiAddRouteFunc uses the f function to add a route to the router, wrapping the handler to add params to request context.
func EchoAddRouteFunc ¶ added in v1.3.1
func EchoAddRouteFunc(f EchoAddRouteType) AddRouteFunc
EchoAddRouteFunc uses the f function to add a route to the router, wrapping the handler to add params to request context.
func FiberAddRouteFunc ¶ added in v1.3.1
func FiberAddRouteFunc(f FiberAddRouteType) AddRouteFunc
FiberAddRouteFunc uses the f function to add a route to the router, wrapping the handler to add params to request context.
func GinAddRouteFunc ¶ added in v1.3.1
func GinAddRouteFunc(f GinAddRouteType) AddRouteFunc
GinAddRouteFunc uses the f function to add a route to the router, wrapping the handler to add params to request context.
func GorillaAddRouteFunc ¶ added in v1.3.1
func GorillaAddRouteFunc(r *mux.Router, mid func(h http.Handler) http.HandlerFunc, method string) AddRouteFunc
GorillaAddRouteFunc is used to add a route to the router, using the given method. It adds the middleware function to the handler. It adds params to request context.
type AddRouteFunctions ¶ added in v1.3.1
type AddRouteFunctions struct { Post AddRouteFunc Get AddRouteFunc Put AddRouteFunc Patch AddRouteFunc Delete AddRouteFunc Head AddRouteFunc }
AddRouteFunctions is a struct that contains the functions to add routes to a router, one for each request method. Each router/framework should implement this struct.
type EchoAddRouteType ¶ added in v1.3.1
type EchoAddRouteType func(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
EchoAddRouteType is the type of the function that echo.Echo uses to add routes to the router. Example: r.POST, r.GET...
type FiberAddRouteType ¶ added in v1.3.1
type FiberAddRouteType func(path string, handlers ...fiber.Handler) fiber.Router
FiberAddRouteType is the type of the function that fiber.App uses to add routes to the router. Example: r.Post, r.Get...
type GinAddRouteType ¶ added in v1.3.1
type GinAddRouteType func(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
GinAddRouteType is the type of the function that gin.Engine uses to add routes to the router. Example: r.POST, r.GET...