(sourceParam string, customFunc func(values []string) []error, valueMustExist bool)
| 234 | } |
| 235 | |
| 236 | func (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 |
| 255 | func (b *ValueBinder) String(sourceParam string, dest *string) *ValueBinder { |
no test coverage detected