Skip to content
/ cadence Public

Modified cron syntax for calculating when to run a job.

License

Notifications You must be signed in to change notification settings

bradhe/cadence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⏰ Cadence

This package is a simple interface in to calculating the next occurence of an event based on cron syntax. It also supports a more human-readable syntax to make, all behind a single interface.

import "github.com/bradhe/cadence"

Example

package main

import (
    "fmt"

    "github.com/bradhe/cadence"
)

func main() {
    // Supports cron syntax with seconds
    t, _ := cadence.Next("*/5 * * * * *", time.Now()))
    fmt.Printf("Next run: %v\n", t)

    // Special cases some human readable syntax, too!
    t, _ = cadence.Next("every hour", time.Now()))
    fmt.Printf("Next run: %v\n", t)
}

About

Modified cron syntax for calculating when to run a job.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages