https://github.com/whiteShtef/clockwork
https://github.com/whiteShtef/clockwork
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/whiteShtef/clockwork
- Owner: whiteShtef
- License: mit
- Created: 2020-02-21T01:25:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T12:13:35.000Z (over 5 years ago)
- Last Synced: 2024-10-14T09:21:49.807Z (over 1 year ago)
- Language: Go
- Size: 308 KB
- Stars: 27
- Watchers: 1
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - clockwork - A simple and intuitive scheduling library in Go. - ★ 34 (Utilities)
- awesome-go-cn - clockwork
- awesome-Char - clockwork - Simple and intuitive job scheduling library in Go. (Job Scheduler / Advanced Console UIs)
- awesome-go - clockwork - Simple and intuitive job scheduling library in Go. - :arrow_down:1 - :star:32 (Job Scheduler / Advanced Console UIs)
- awesome-go-cn - clockwork
- awesome-go-processed - clockwork - Simple and intuitive job scheduling library in Go.| (Utilities / Advanced Console UIs)
- awesome-go - clockwork - Simple and intuitive job scheduling library in Go. (Job Scheduler / Advanced Console UIs)
- awesome-go - clockwork - | - | - | (Job Scheduler / Advanced Console UIs)
- awesome-go-zh - clockwork
README
# clockwork

[](https://github.com/sindresorhus/awesome)
[](https://godoc.org/github.com/whiteshtef/clockwork)
[](https://goreportcard.com/report/github.com/whiteshtef/clockwork)

A simple and intuitive scheduling library in Go.
Inspired by [python's schedule](https://github.com/dbader/schedule) and [ruby's clockwork](https://github.com/adamwiggins/clockwork) libraries.
## Example use
```go
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](https://golang.github.io/dep/) for dependency management.