Parse
Overview
Parse validates a cron expression (with optional seconds field).
Part of the cron package — Node.js analog: node-cron.
Signature
go
func Parse(expr string) errorCompare: Node.js · Standard Go · gox
js
// Typical node-cron pattern in Node.jsgo
c := cron.New()
c.AddFunc(spec, fn)
c.Start()go
import "github.com/sahilkhaire/gox/cron"
spec, err := cron.Parse("0 * * * *")Example
go
import "github.com/sahilkhaire/gox/cron"
spec, err := cron.Parse("0 * * * *")Tips
Import github.com/sahilkhaire/gox/cron and call Parse directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
c := cron.New()
c.AddFunc(spec, fn)
c.Start()