helper

package
v0.0.0-...-60051b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultJsonErrorHandlerConfig = JsonErrorHandlerConfig{
	Err:      errors.New("opps, an error occured"),
	HTTPCode: int(std.StatusServerError),
}

DefaultJsonErrorHandlerConfig is the default config

Functions

This section is empty.

Types

type JsonErrorHandlerConfig

type JsonErrorHandlerConfig struct {
	// Err a error
	Err error

	// HTTPCode define http status code sended to response
	HTTPCode int
}

JsonErrorHandlerConfig defines the config for Json Error Handler helper

func (JsonErrorHandlerConfig) JsonErrorHandler

func (cfg JsonErrorHandlerConfig) JsonErrorHandler(err error, c echo.Context)

JsonErrorHandler return Json Error Handler helper. If config not given, will use the default

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator defines the validator config

func NewValidator

func NewValidator() *Validator

NewValidator creates new validator instances

func (*Validator) Validate

func (v *Validator) Validate(i interface{}) error

Validate validates given struct and return error Otherwise return nil if pass the validate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL