Skip to content
Node: node-crongithub.com/sahilkhaire/gox/cron

Scheduler

Overview

Scheduler runs cron jobs in the background.

Part of the cron package — Node.js analog: node-cron.

Scheduler is a type exported by gox. Methods on this type are documented separately.

Signature

go
type Scheduler struct {
	// contains filtered or unexported fields
}

Compare: Node.js · Standard Go · gox

js
// Typical node-cron pattern in Node.js
go
c := cron.New()
c.AddFunc(spec, fn)
c.Start()
go
import "github.com/sahilkhaire/gox/cron"

sched := cron.NewScheduler()
sched.Every(time.Hour, func() { fmt.Println("tick") })

Example

go
import "github.com/sahilkhaire/gox/cron"

sched := cron.NewScheduler()
sched.Every(time.Hour, func() { fmt.Println("tick") })

Tips

Browse methods on this type in the sidebar for handler-style APIs and options structs.

Standard library alternative

Use the standard library directly:

go
c := cron.New()
c.AddFunc(spec, fn)
c.Start()

Back to cron package overview

MIT Licensed · Built for Node.js developers moving to Go