package response import ( "github.com/gin-gonic/gin" ) type ( HandlerFunc = func(c *gin.Context) (Response, error) Middleware = func(HandlerFunc) HandlerFunc ) func Handler(f HandlerFunc) gin.HandlerFunc { return func(c *gin.Context) { res, err := f(c) if err != nil { c.Error(err) } else { Write(c, res) } } }