feat: add DAG core functions — parse, validate, topo sort, resolve env, cron match (0007a, 0007d)
Pure functions for parsing dagu-compatible YAML, validating DAG structure, topological sorting with parallel levels (Kahn's algorithm), and env variable resolution. Also adds cron_match for schedule matching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package core
|
||||
|
||||
import "time"
|
||||
|
||||
// CronMatch returns true if time t matches all fields of the cron schedule.
|
||||
func CronMatch(sched CronSchedule, t time.Time) bool {
|
||||
return intIn(t.Minute(), sched.Minute) &&
|
||||
intIn(t.Hour(), sched.Hour) &&
|
||||
intIn(t.Day(), sched.DayOfMonth) &&
|
||||
intIn(int(t.Month()), sched.Month) &&
|
||||
intIn(int(t.Weekday()), sched.DayOfWeek)
|
||||
}
|
||||
Reference in New Issue
Block a user