Documentation
¶
Index ¶
- Variables
- func AddTagParsers(parser tagParser)
- func CheckErrors(opts ValidateParams) (ok bool, err error)
- func NewBinder(v Validator) echo.Binder
- func NewEngine(params EngineParams) *echo.Echo
- func NewLogger(log *zap.Logger) echo.Logger
- func NewMultiServer(params MultiServerParams) mserv.Server
- type APIParams
- type CustomError
- type EmptyWriter
- type EngineParams
- type FieldError
- type FieldLevel
- type Func
- type MultiServerParams
- type ServerResult
- type ValidateParams
- type Validator
Constants ¶
This section is empty.
Variables ¶
var EngineModule = module.Module{ {Constructor: NewValidator}, {Constructor: NewBinder}, {Constructor: NewEngine}, }
var Null = new(EmptyWriter)
Null is /dev/null emulation
var ( // ServersModule of web base structs ServersModule = module.Module{ {Constructor: NewAPIServer}, {Constructor: NewMetricsServer}, {Constructor: NewPprofServer}, {Constructor: NewMultiServer}, } )
Functions ¶
func AddTagParsers ¶ added in v0.5.0
func AddTagParsers(parser tagParser)
AddTagParsers used in fieldName
func CheckErrors ¶ added in v0.5.0
func CheckErrors(opts ValidateParams) (ok bool, err error)
CheckErrors of validator and return formatted errors:
func NewEngine ¶
func NewEngine(params EngineParams) *echo.Echo
NewEngine returns configured echo engine
func NewMultiServer ¶ added in v0.5.0
func NewMultiServer(params MultiServerParams) mserv.Server
NewMultiServer returns new multi servers group
Types ¶
type APIParams ¶ added in v0.5.0
type APIParams struct { dig.In Config *viper.Viper Logger logger.StdLogger Handler http.Handler `optional:"true"` }
APIParams struct
type CustomError ¶ added in v0.4.1
type CustomError interface {
FormatResponse(ctx echo.Context) error
}
CustomError interface
type EngineParams ¶ added in v0.5.0
type EngineParams struct { dig.In Config *viper.Viper `optional:"true"` Binder echo.Binder `optional:"true"` Logger *zap.Logger `optional:"true"` EchoLogger echo.Logger `optional:"true"` Validator echo.Validator `optional:"true"` }
EngineParams struct
type FieldError ¶ added in v0.5.0
FieldError contains field name and validator error
func (FieldError) Error ¶ added in v0.5.0
func (f FieldError) Error() string
type FieldLevel ¶ added in v0.5.0
type FieldLevel = validator.FieldLevel
FieldLevel contains all the information and helper functions to validate a field
type Func ¶ added in v0.5.0
type Func = validator.Func
Func accepts a FieldLevel interface for all validation needs. The return value should be true when validation succeeds.
type MultiServerParams ¶ added in v0.5.0
type MultiServerParams struct { dig.In Logger logger.StdLogger Servers []mserv.Server `group:"web_server"` }
MultiServerParams struct
type ServerResult ¶ added in v0.5.0
ServerResult struct
func NewAPIServer ¶ added in v0.5.0
NewAPIServer creates api server by http.Handler from DI container
func NewMetricsServer ¶ added in v0.5.0
func NewMetricsServer(v *viper.Viper, l logger.StdLogger) ServerResult
NewMetricsServer returns wrapped prometheus http server
func NewPprofServer ¶ added in v0.5.0
func NewPprofServer(v *viper.Viper, l logger.StdLogger) ServerResult
NewPprofServer returns wrapped pprof http server
type ValidateParams ¶ added in v0.5.0
type ValidateParams struct { Struct interface{} Errors error Formatter func(fields []*FieldError) string }
ValidateParams to call CheckErrors method
type Validator ¶ added in v0.5.0
Validator to implement custom echo.Validator
func NewValidator ¶ added in v0.5.0
func NewValidator() Validator
NewValidator returns custom echo.Validator
func WrapValidator ¶ added in v0.5.0
func WrapValidator(v *validator.Validate) Validator
WrapValidator wraps v9.validator