- Scheduler wraps gocron with Start/Stop lifecycle - Start loads enabled jobs from DB and registers cron schedules - AddJob/RemoveJob persist to DB and sync with gocron - RunJob for manual trigger with OnComplete callback - JobResult struct for notification bridge - Promote gocron/v2 v2.19.1 to direct dependency
22 lines
477 B
Go
22 lines
477 B
Go
package scheduler
|
|
|
|
import "time"
|
|
|
|
// Job represents a scheduled scan job with its runtime function.
|
|
type Job struct {
|
|
Name string
|
|
CronExpr string
|
|
ScanCommand string
|
|
NotifyTelegram bool
|
|
Enabled bool
|
|
RunFunc func(ctx interface{}) (int, error)
|
|
}
|
|
|
|
// JobResult contains the outcome of a scheduled or manually triggered scan job.
|
|
type JobResult struct {
|
|
JobName string
|
|
FindingCount int
|
|
Duration time.Duration
|
|
Error error
|
|
}
|