• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    Go
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⏰ A simple and intuitive scheduling library in Go.

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