Shigoto is a task scheduling for Golang with friendly API. Shigoto used MongoDB for persistent storage and used Cron format to set the schedule.
go get github.com/KodepandaID/shigoto
package main
import "github.com/KodepandaID/shigoto"
func main() {
client, e := shigoto.New(&shigoto.Config{
DB: "mongodb://localhost:27017",
DBName: "jobs-scheduler",
Timezone: "Asia/Jakarta",
})
if e != nil {
log.Fatal(e)
}
client.Run()
}
func main() {
client, e := shigoto.New(&shigoto.Config{
DB: "mongodb://localhost:27017",
DBName: "jobs-scheduler",
Timezone: "Asia/Jakarta",
})
if e != nil {
log.Fatal(e)
}
client.Register("hello", hello)
client.Register("hello-params", helloParams, "message here")
client.Run()
}
func hello() error {
return nil
}
func helloParams(message string) error {
return nil
}
For more scheduling information, you can read at Go References.
func main() {
client, e := shigoto.New(&shigoto.Config{
DB: "mongodb://localhost:27017",
DBName: "jobs-scheduler",
Timezone: "Asia/Jakarta",
})
if e != nil {
log.Fatal(e)
}
client.Register("hello", hello)
if _, e := client.
Command("job-name-here", "hello").
EveryMinute().Do(); e != nil {
log.Fatal(e)
}
client.Run()
}
func hello() error {
return nil
}
func main() {
client, e := shigoto.New(&shigoto.Config{
DB: "mongodb://localhost:27017",
DBName: "jobs-scheduler",
Timezone: "Asia/Jakarta",
})
if e != nil {
log.Fatal(e)
}
client.Register("hello", hello)
client.Delete("hello")
client.Run()
}
Copyright Yudha Pratama Wicaksana, Licensed under MIT.