Categorygithub.com/whiteshtef/clockwork
modulepackage
0.0.0-20200221012748-027e62affd84
Repository: https://github.com/whiteshtef/clockwork.git
Documentation: pkg.go.dev

# README

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/whiteshtef/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 uses go dep for dependency management.

# Packages

No description provided by the author

# Functions

NewScheduler creates and returns a new Scheduler.

# Structs

Job struct handles all the data required to schedule and run jobs.
Scheduler type is used to store a group of jobs (Job structs).

# Type aliases

TimeUnit is an numeration used for handling time units internally.