(interval int, unit string, hasWeekdaysSuffix bool)
| 298 | } |
| 299 | |
| 300 | func formatLongIntervalCron(interval int, unit string, hasWeekdaysSuffix bool) (string, error) { |
| 301 | switch unit { |
| 302 | case "minutes": |
| 303 | if hasWeekdaysSuffix { |
| 304 | return "", errors.New("minute intervals with 'on weekdays' are not supported") |
| 305 | } |
| 306 | return fmt.Sprintf("FUZZY:EVERY_MINUTE/%d * * * *", interval), nil |
| 307 | case "hours": |
| 308 | return formatHourlyIntervalCron(interval, hasWeekdaysSuffix), nil |
| 309 | case "days": |
| 310 | return formatDailyIntervalCron(interval), nil |
| 311 | default: |
| 312 | return "", fmt.Errorf("unsupported interval unit '%s', use 'minutes', 'hours', or 'days'", unit) |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | func formatHourlyIntervalCron(interval int, hasWeekdaysSuffix bool) string { |
| 317 | if hasWeekdaysSuffix { |
no test coverage detected