Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultLoggerConfig = middleware.RequestLoggerConfig{ LogMethod: true, LogURIPath: true, LogStatus: true, LogLatency: true, HandleError: true, LogValuesFunc: DefaultLogValuesFunc, }
var Validator = makeValidator()
Validator implements echo.Validator and can be set as validator in echo. It is probably better to use BindAndValidate though.
Functions ¶
func BindAndValidate ¶
BindAndValidate binds the request data to a new instance of type T using c.Bind and then validates the struct using Validator.
func DefaultLogValuesFunc ¶
func DefaultLogValuesFunc(c *echo.Context, v middleware.RequestLoggerValues) error
func ErrorHandler ¶
func ErrorHandler(mapper ErrorMapper) echo.HTTPErrorHandler
ErrorHandler returns an echo error handler. It applies the mapper to the error first and falls back to the default error mapping rules if the mapper returns false or is not defined. Errors are always logged, and if the response has already been committed it can only log, not write a body.
func Logging ¶
func Logging() echo.MiddlewareFunc
Logging returns the default logging middleware. If you dont want that, you can use the DefaultLoggerConfig and DefaultLogValuesFunc to build your own logging middleware
Types ¶
type ErrorMapper ¶
type ErrorMapper func(err error) (api.ErrorResponse, bool)
ErrorMapper translates an arbitrary error into an ErrorResponse. It returns false to signal that it does not handle the given error, in which case the default mapping rules are applied.