项目作者: tssaini

项目描述 :
Persistent job scheduling for Golang
高级语言: Go
项目地址: git://github.com/tssaini/go-agenda.git
创建时间: 2020-07-28T03:14:18Z
项目社区:https://github.com/tssaini/go-agenda

开源协议:MIT License

下载


go-agenda

go-agenda is a Go library that allows you to schedule jobs and persist them in a SQL database. It is inspired by the Agenda Node.js library.

Build Status
Go Report Card
GoDoc

Features

  • Schedules job using a cron expression
  • Stores the job metadata such as next run time, last run time and any errors produced in the SQL database

Usage

  1. db, _ := sql.Open("mysql", "user:test@/goagenda")
  2. agenda, _ := agenda.New(db)
  3. agenda.Define("print hello", func() error {
  4. fmt.Println("Hello world")
  5. return nil
  6. })
  7. // Will run the job at the beginning of every minute
  8. agenda.RepeatEvery("print hello", "* * * * *")
  9. agenda.Start()

See cmd/main.go for a working example.