MCPcopy Index your code
hub / github.com/labstack/echo / customFunc

Method customFunc

binder.go:236–252  ·  view source on GitHub ↗
(sourceParam string, customFunc func(values []string) []error, valueMustExist bool)

Source from the content-addressed store, hash-verified

234}
235
236func (b *ValueBinder) customFunc(sourceParam string, customFunc func(values []string) []error, valueMustExist bool) *ValueBinder {
237 if b.failFast && b.errors != nil {
238 return b
239 }
240
241 values := b.ValuesFunc(sourceParam)
242 if len(values) == 0 {
243 if valueMustExist {
244 b.setError(b.ErrorFunc(sourceParam, []string{}, "required field value is empty", nil))
245 }
246 return b
247 }
248 if errs := customFunc(values); errs != nil {
249 b.errors = append(b.errors, errs...)
250 }
251 return b
252}
253
254// String binds parameter to string variable
255func (b *ValueBinder) String(sourceParam string, dest *string) *ValueBinder {

Callers 2

CustomFuncMethod · 0.95
MustCustomFuncMethod · 0.95

Calls 1

setErrorMethod · 0.95

Tested by

no test coverage detected