Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1.64 KB

README.md

File metadata and controls

50 lines (34 loc) · 1.64 KB

clockwork

Awesome GoDoc Go Report Card Coverage

A simple and intuitive scheduling library in Go.

Inspired by python's schedule and ruby's clockwork libraries.

Example use

package main

import (
	"fmt"
	"github.com/sbrki/clockwork"
)

func main() {
	sched := clockwork.NewScheduler()

	sched.Schedule().Every(10).Seconds().Do(something)
	sched.Schedule().Every(3).Minutes().Do(something)
	sched.Schedule().Every(4).Hours().Do(something)
	sched.Schedule().Every(2).Days().At("12:32").Do(something)
	sched.Schedule().Every(12).Weeks().Do(something)

	sched.Schedule().Every().Second().Do(something) // Every() is "shorthand" for Every(1)
	sched.Schedule().Every().Monday().Do(something)
	sched.Schedule().Every().Saturday().At("8:00").Do(something)

	sched.Run()
}

func something() {
	fmt.Println("foo")

}

The package used to use go dep for dependency management. It has switched to go modules as of commit 5f1b50934f209adb9930ef98fe654f814156a858, which became available under v1.0.0