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

Function formatShortDurationCron

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

Source from the content-addressed store, hash-verified

278}
279
280func 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
300func formatLongIntervalCron(interval int, unit string, hasWeekdaysSuffix bool) (string, error) {
301 switch unit {

Callers 1

Calls 5

formatHourlyIntervalCronFunction · 0.85
formatDailyIntervalCronFunction · 0.85
formatWeeklyIntervalCronFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected