(sectionName string, required bool, callbacks ...ValidatorCallback)
| 254 | } |
| 255 | |
| 256 | func (a *Application) intSection(sectionName string, required bool, callbacks ...ValidatorCallback) int { |
| 257 | value := a.stringSection(sectionName, required, callbacks...) |
| 258 | |
| 259 | // Don't bother proceeding if there's already an error parsing the string |
| 260 | if a.validator.HasError(sectionName) || value == "" { |
| 261 | return 0 |
| 262 | } |
| 263 | |
| 264 | pass, number, message := ParseNumber(value) |
| 265 | if !pass { |
| 266 | a.validator.AddError(sectionName, fmt.Sprintf("%d", number), message) |
| 267 | return 0 |
| 268 | } |
| 269 | |
| 270 | return number |
| 271 | } |
| 272 | |
| 273 | func (a *Application) boolSection(sectionName string, required bool, callbacks ...ValidatorCallback) bool { |
| 274 | value := a.stringSection(sectionName, required, callbacks...) |
no test coverage detected