MCPcopy Create free account
hub / github.com/kataras/iris / Func

Method Func

x/errors/validation/error.go:64–70  ·  view source on GitHub ↗

Func accepts a variadic number of functions which accept the value of the field and return a string message if the value is invalid. It joins the reasons into one.

(fns ...func(value T) string)

Source from the content-addressed store, hash-verified

62// and return a string message if the value is invalid.
63// It joins the reasons into one.
64func (e *FieldError[T]) Func(fns ...func(value T) string) *FieldError[T] {
65 for _, fn := range fns {
66 e.joinReason(fn(e.Value))
67 }
68
69 return e
70}
71
72// Join joins the given validation errors into one.
73func Join(errs ...errors.ValidationError) error { // note that here we return the standard error type instead of the errors.ValidationError in order to make the error nil instead of ValidationErrors(nil) on empty slice.

Callers 11

PositiveMethod · 0.80
NegativeMethod · 0.80
ZeroMethod · 0.80
NonZeroMethod · 0.80
InRangeMethod · 0.80
NotEmptyMethod · 0.80
FullnameMethod · 0.80
LengthMethod · 0.80
NotEmptyMethod · 0.80
LengthMethod · 0.80
AddFuncMethod · 0.80

Calls 1

joinReasonMethod · 0.95

Tested by

no test coverage detected