Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whiteShtef/clockwork
https://github.com/whiteShtef/clockwork
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/whiteShtef/clockwork
- Owner: whiteShtef
- License: mit
- Created: 2020-02-21T01:25:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T12:13:35.000Z (over 4 years ago)
- Last Synced: 2024-10-14T09:21:49.807Z (3 months 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)
README
# clockwork
[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)
[![GoDoc](https://godoc.org/github.com/whiteshtef/clockwork?status.svg)](https://godoc.org/github.com/whiteshtef/clockwork)
[![Go Report Card](https://goreportcard.com/badge/github.com/whiteshtef/clockwork)](https://goreportcard.com/report/github.com/whiteshtef/clockwork)
![Coverage](http://gocover.io/_badge/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 mainimport (
"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.