| 307 | } |
| 308 | |
| 309 | func checkValidValue(value string, fieldType fieldType) (int, error) { |
| 310 | result, err := strconv.Atoi(value) |
| 311 | |
| 312 | if err != nil { |
| 313 | return 0, fmt.Errorf("the value in field %s must be number : %s", fieldType.Field, value) |
| 314 | } |
| 315 | |
| 316 | if fieldType.Field == cronFieldDayOfWeek && result == 0 { |
| 317 | return result, nil |
| 318 | } |
| 319 | |
| 320 | if result >= fieldType.MinValue && result <= fieldType.MaxValue { |
| 321 | return result, nil |
| 322 | } |
| 323 | |
| 324 | return 0, fmt.Errorf("the value in field %s must be between %d and %d", fieldType.Field, fieldType.MinValue, fieldType.MaxValue) |
| 325 | } |
| 326 | |
| 327 | func getTimeValue(t time.Time, field cronField) int { |
| 328 | |