()
| 220 | } |
| 221 | |
| 222 | func (p *ScheduleParser) parseLongIntervalParts() (int, string, error) { |
| 223 | intervalStr := p.tokens[1] |
| 224 | interval, err := strconv.Atoi(intervalStr) |
| 225 | if err != nil || interval < 1 { |
| 226 | return 0, "", fmt.Errorf("invalid interval '%s', must be a positive integer", intervalStr) |
| 227 | } |
| 228 | |
| 229 | unit := p.tokens[2] |
| 230 | if !strings.HasSuffix(unit, "s") { |
| 231 | unit += "s" |
| 232 | } |
| 233 | if unit != "minutes" && unit != "hours" && unit != "days" { |
| 234 | return 0, "", fmt.Errorf("unsupported interval unit '%s', use 'minutes', 'hours', or 'days'", unit) |
| 235 | } |
| 236 | return interval, unit, nil |
| 237 | } |
| 238 | |
| 239 | func (p *ScheduleParser) validateIntervalTimeClause(startPos int, hasWeekdaysSuffix bool) error { |
| 240 | endPos := len(p.tokens) |
no test coverage detected