diff options
| author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-02 16:57:57 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-02 16:57:57 -0800 |
| commit | 94dd1ca677c716975d43f323c97ea26f8fd4c962 (patch) | |
| tree | 7eaf4f32af0a180457f935d5f2fdff941018a12f /scheduler/scheduler.go | |
| download | something-94dd1ca677c716975d43f323c97ea26f8fd4c962.tar.gz something-94dd1ca677c716975d43f323c97ea26f8fd4c962.zip | |
initial commit by simponic-infra
Diffstat (limited to 'scheduler/scheduler.go')
| -rw-r--r-- | scheduler/scheduler.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go new file mode 100644 index 0000000..c152179 --- /dev/null +++ b/scheduler/scheduler.go @@ -0,0 +1,34 @@ +package scheduler + +import ( + "database/sql" + "log" + "time" + + "git.simponic.xyz/simponic/something/args" + "github.com/go-co-op/gocron/v2" +) + +func StartScheduler(_dbConn *sql.DB, argv *args.Arguments) { + scheduler, err := gocron.NewScheduler() + if err != nil { + panic("could not create scheduler") + } + + _, err = scheduler.NewJob( + gocron.DurationJob( + 24*time.Hour, + ), + gocron.NewTask( + func(msg string) { + log.Println(msg) + }, + "it's a beautiful new day!", + ), + ) + if err != nil { + panic("could not create job") + } + + scheduler.Start() +} |
