MCPcopy Create free account
hub / github.com/github/gh-aw / formatLongIntervalCron

Function formatLongIntervalCron

pkg/parser/schedule_parser.go:300–314  ·  view source on GitHub ↗
(interval int, unit string, hasWeekdaysSuffix bool)

Source from the content-addressed store, hash-verified

298}
299
300func 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
316func formatHourlyIntervalCron(interval int, hasWeekdaysSuffix bool) string {
317 if hasWeekdaysSuffix {

Callers 1

parseLongIntervalMethod · 0.85

Calls 3

formatHourlyIntervalCronFunction · 0.85
formatDailyIntervalCronFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected