(interval int, unit string, hasWeekdaysSuffix bool)
| 278 | } |
| 279 | |
| 280 | func formatShortDurationCron(interval int, unit string, hasWeekdaysSuffix bool) (string, error) { |
| 281 | switch unit { |
| 282 | case "m": |
| 283 | if hasWeekdaysSuffix { |
| 284 | return "", errors.New("minute intervals with 'on weekdays' are not supported") |
| 285 | } |
| 286 | return fmt.Sprintf("FUZZY:EVERY_MINUTE/%d * * * *", interval), nil |
| 287 | case "h": |
| 288 | return formatHourlyIntervalCron(interval, hasWeekdaysSuffix), nil |
| 289 | case "d": |
| 290 | return formatDailyIntervalCron(interval), nil |
| 291 | case "w": |
| 292 | return formatWeeklyIntervalCron(interval), nil |
| 293 | case "mo": |
| 294 | return formatMonthlyIntervalCron(interval), nil |
| 295 | default: |
| 296 | return "", fmt.Errorf("unsupported duration unit '%s'", unit) |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | func formatLongIntervalCron(interval int, unit string, hasWeekdaysSuffix bool) (string, error) { |
| 301 | switch unit { |
no test coverage detected