chore: rename module
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# gocron: A Golang Job Scheduling Package
|
||||
|
||||
[](https://github.com/go-co-op/gocron/actions)
|
||||
 [](https://pkg.go.dev/github.com/go-co-op/gocron/v2)
|
||||
[](https://github.com/andoma-go/gocron/actions)
|
||||
 [](https://pkg.go.dev/github.com/andoma-go/gocron/v2)
|
||||
|
||||
gocron is a job scheduling package which lets you run Go functions at pre-determined intervals.
|
||||
|
||||
@@ -11,7 +11,7 @@ If you want to chat, you can find us on Slack at
|
||||
## Quick Start
|
||||
|
||||
```
|
||||
go get github.com/go-co-op/gocron/v2
|
||||
go get github.com/andoma-go/gocron/v2
|
||||
```
|
||||
|
||||
```golang
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-co-op/gocron/v2"
|
||||
"github.com/andoma-go/gocron/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -70,77 +70,90 @@ func main() {
|
||||
- **Executor**: The executor calls the job's task and manages the complexities of different job
|
||||
execution timing requirements (e.g. singletons that shouldn't overrun each other, limiting the max number of jobs running)
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
### Job types
|
||||
|
||||
Jobs can be run at various intervals.
|
||||
- [**Duration**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#DurationJob):
|
||||
Jobs can be run at a fixed `time.Duration`.
|
||||
- [**Random duration**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#DurationRandomJob):
|
||||
Jobs can be run at a random `time.Duration` between a min and max.
|
||||
- [**Cron**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#CronJob):
|
||||
Jobs can be run using a crontab.
|
||||
- [**Daily**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#DailyJob):
|
||||
Jobs can be run every x days at specific times.
|
||||
- [**Weekly**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WeeklyJob):
|
||||
Jobs can be run every x weeks on specific days of the week and at specific times.
|
||||
- [**Monthly**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#MonthlyJob):
|
||||
Jobs can be run every x months on specific days of the month and at specific times.
|
||||
- [**One time**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#OneTimeJob):
|
||||
Jobs can be run once at a specific time. These are non-recurring jobs.
|
||||
|
||||
- [**Duration**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#DurationJob):
|
||||
Jobs can be run at a fixed `time.Duration`.
|
||||
- [**Random duration**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#DurationRandomJob):
|
||||
Jobs can be run at a random `time.Duration` between a min and max.
|
||||
- [**Cron**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#CronJob):
|
||||
Jobs can be run using a crontab.
|
||||
- [**Daily**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#DailyJob):
|
||||
Jobs can be run every x days at specific times.
|
||||
- [**Weekly**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WeeklyJob):
|
||||
Jobs can be run every x weeks on specific days of the week and at specific times.
|
||||
- [**Monthly**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#MonthlyJob):
|
||||
Jobs can be run every x months on specific days of the month and at specific times.
|
||||
- [**One time**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#OneTimeJob):
|
||||
Jobs can be run once at a specific time. These are non-recurring jobs.
|
||||
|
||||
### Concurrency Limits
|
||||
|
||||
Jobs can be limited individually or across the entire scheduler.
|
||||
- [**Per job limiting with singleton mode**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithSingletonMode):
|
||||
Jobs can be limited to a single concurrent execution that either reschedules (skips overlapping executions)
|
||||
or queues (waits for the previous execution to finish).
|
||||
- [**Per scheduler limiting with limit mode**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithLimitConcurrentJobs):
|
||||
Jobs can be limited to a certain number of concurrent executions across the entire scheduler
|
||||
using either reschedule (skip when the limit is met) or queue (jobs are added to a queue to
|
||||
wait for the limit to be available).
|
||||
|
||||
- [**Per job limiting with singleton mode**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithSingletonMode):
|
||||
Jobs can be limited to a single concurrent execution that either reschedules (skips overlapping executions)
|
||||
or queues (waits for the previous execution to finish).
|
||||
- [**Per scheduler limiting with limit mode**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithLimitConcurrentJobs):
|
||||
Jobs can be limited to a certain number of concurrent executions across the entire scheduler
|
||||
using either reschedule (skip when the limit is met) or queue (jobs are added to a queue to
|
||||
wait for the limit to be available).
|
||||
- **Note:** A scheduler limit and a job limit can both be enabled.
|
||||
|
||||
### Distributed instances of gocron
|
||||
|
||||
Multiple instances of gocron can be run.
|
||||
- [**Elector**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithDistributedElector):
|
||||
An elector can be used to elect a single instance of gocron to run as the primary with the
|
||||
other instances checking to see if a new leader needs to be elected.
|
||||
- Implementations: [go-co-op electors](https://github.com/go-co-op?q=-elector&type=all&language=&sort=)
|
||||
- [**Locker**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithDistributedLocker):
|
||||
A locker can be used to lock each run of a job to a single instance of gocron.
|
||||
- Implementations: [go-co-op lockers](https://github.com/go-co-op?q=-lock&type=all&language=&sort=)
|
||||
|
||||
- [**Elector**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithDistributedElector):
|
||||
An elector can be used to elect a single instance of gocron to run as the primary with the
|
||||
other instances checking to see if a new leader needs to be elected.
|
||||
- Implementations: [andoma-go electors](https://github.com/andoma-go?q=-elector&type=all&language=&sort=)
|
||||
- [**Locker**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithDistributedLocker):
|
||||
A locker can be used to lock each run of a job to a single instance of gocron.
|
||||
- Implementations: [andoma-go lockers](https://github.com/andoma-go?q=-lock&type=all&language=&sort=)
|
||||
|
||||
### Events
|
||||
|
||||
Job events can trigger actions.
|
||||
- [**Listeners**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithEventListeners):
|
||||
Can be added to a job, with [event listeners](https://pkg.go.dev/github.com/go-co-op/gocron/v2#EventListener),
|
||||
or all jobs across the
|
||||
[scheduler](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithGlobalJobOptions)
|
||||
to listen for job events and trigger actions.
|
||||
|
||||
- [**Listeners**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithEventListeners):
|
||||
Can be added to a job, with [event listeners](https://pkg.go.dev/github.com/andoma-go/gocron/v2#EventListener),
|
||||
or all jobs across the
|
||||
[scheduler](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithGlobalJobOptions)
|
||||
to listen for job events and trigger actions.
|
||||
|
||||
### Options
|
||||
|
||||
Many job and scheduler options are available.
|
||||
- [**Job options**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#JobOption):
|
||||
Job options can be set when creating a job using `NewJob`.
|
||||
- [**Global job options**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithGlobalJobOptions):
|
||||
Global job options can be set when creating a scheduler using `NewScheduler`
|
||||
and the `WithGlobalJobOptions` option.
|
||||
- [**Scheduler options**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#SchedulerOption):
|
||||
Scheduler options can be set when creating a scheduler using `NewScheduler`.
|
||||
|
||||
- [**Job options**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#JobOption):
|
||||
Job options can be set when creating a job using `NewJob`.
|
||||
- [**Global job options**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithGlobalJobOptions):
|
||||
Global job options can be set when creating a scheduler using `NewScheduler`
|
||||
and the `WithGlobalJobOptions` option.
|
||||
- [**Scheduler options**](https://pkg.go.dev/github.com/andoma-go/gocron/v2#SchedulerOption):
|
||||
Scheduler options can be set when creating a scheduler using `NewScheduler`.
|
||||
|
||||
### Logging
|
||||
|
||||
Logs can be enabled.
|
||||
- [Logger](https://pkg.go.dev/github.com/go-co-op/gocron/v2#Logger):
|
||||
The Logger interface can be implemented with your desired logging library.
|
||||
The provided NewLogger uses the standard library's log package.
|
||||
|
||||
- [Logger](https://pkg.go.dev/github.com/andoma-go/gocron/v2#Logger):
|
||||
The Logger interface can be implemented with your desired logging library.
|
||||
The provided NewLogger uses the standard library's log package.
|
||||
|
||||
### Testing
|
||||
|
||||
The gocron library is set up to enable testing.
|
||||
|
||||
- Mocks are provided in [the mock package](mocks) using [gomock](https://github.com/uber-go/mock).
|
||||
- Time can be mocked by passing in a [FakeClock](https://pkg.go.dev/github.com/jonboulle/clockwork#FakeClock)
|
||||
to [WithClock](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithClock) -
|
||||
see the [example on WithClock](https://pkg.go.dev/github.com/go-co-op/gocron/v2#example-WithClock).
|
||||
to [WithClock](https://pkg.go.dev/github.com/andoma-go/gocron/v2#WithClock) -
|
||||
see the [example on WithClock](https://pkg.go.dev/github.com/andoma-go/gocron/v2#example-WithClock).
|
||||
|
||||
## Supporters
|
||||
|
||||
@@ -153,4 +166,4 @@ This project is supported by:
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://star-history.com/#go-co-op/gocron&Date)
|
||||
[](https://star-history.com/#andoma-go/gocron&Date)
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ The current plan is to maintain version 1 as long as possible incorporating any
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Vulnerabilities can be reported by [opening an issue](https://github.com/go-co-op/gocron/issues/new/choose) or reaching out on Slack: [<img src="https://img.shields.io/badge/gophers-gocron-brightgreen?logo=slack">](https://gophers.slack.com/archives/CQ7T0T1FW)
|
||||
Vulnerabilities can be reported by [opening an issue](https://github.com/andoma-go/gocron/issues/new/choose) or reaching out on Slack: [<img src="https://img.shields.io/badge/gophers-gocron-brightgreen?logo=slack">](https://gophers.slack.com/archives/CQ7T0T1FW)
|
||||
|
||||
We will do our best to addrerss any vulnerabilities in an expeditious manner.
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
. "github.com/go-co-op/gocron/v2" // nolint:revive
|
||||
. "github.com/andoma-go/gocron/v2" // nolint:revive
|
||||
"github.com/google/uuid"
|
||||
"github.com/jonboulle/clockwork"
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/go-co-op/gocron/v2
|
||||
module github.com/andoma-go/gocron/v2
|
||||
|
||||
go 1.20
|
||||
|
||||
|
||||
+4
-3
@@ -3,18 +3,19 @@
|
||||
## Quick Start
|
||||
|
||||
```
|
||||
go get github.com/go-co-op/gocronmocks/v2
|
||||
go get github.com/andoma-go/gocronmocks/v2
|
||||
```
|
||||
|
||||
write a test
|
||||
|
||||
```golang
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-co-op/gocron/v2"
|
||||
"github.com/go-co-op/gocronmocks/v2"
|
||||
"github.com/andoma-go/gocron/v2"
|
||||
"github.com/andoma-go/gocronmocks/v2"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/go-co-op/gocron/v2 (interfaces: Elector,Locker,Lock)
|
||||
// Source: github.com/andoma-go/gocron/v2 (interfaces: Elector,Locker,Lock)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
gocron "github.com/go-co-op/gocron/v2"
|
||||
gocron "github.com/andoma-go/gocron/v2"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
module github.com/go-co-op/gocronmocks/v2
|
||||
module github.com/andoma-go/gocronmocks/v2
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/go-co-op/gocron/v2 v2.0.0-rc4
|
||||
github.com/andoma-go/gocron/v2 v2.0.0-rc4
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/google/uuid v1.4.0
|
||||
go.uber.org/mock v0.3.0
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/go-co-op/gocron/v2 v2.0.0-rc4 h1:KFYg2CzyHZwPZL/uNnQKEyeL9oKEUQbiLThArcZaVmw=
|
||||
github.com/go-co-op/gocron/v2 v2.0.0-rc4/go.mod h1:3SLoqKnyORFVN0VvFFb1383hM4WD9XHBPn9aUUp7sQs=
|
||||
github.com/andoma-go/gocron/v2 v2.0.0-rc4 h1:KFYg2CzyHZwPZL/uNnQKEyeL9oKEUQbiLThArcZaVmw=
|
||||
github.com/andoma-go/gocron/v2 v2.0.0-rc4/go.mod h1:3SLoqKnyORFVN0VvFFb1383hM4WD9XHBPn9aUUp7sQs=
|
||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/go-co-op/gocron/v2 (interfaces: Job)
|
||||
// Source: github.com/andoma-go/gocron/v2 (interfaces: Job)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/go-co-op/gocron/v2 (interfaces: Logger)
|
||||
// Source: github.com/andoma-go/gocron/v2 (interfaces: Logger)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/go-co-op/gocron/v2 (interfaces: Scheduler)
|
||||
// Source: github.com/andoma-go/gocron/v2 (interfaces: Scheduler)
|
||||
|
||||
// Package gocronmocks is a generated GoMock package.
|
||||
package gocronmocks
|
||||
@@ -7,7 +7,7 @@ package gocronmocks
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
gocron "github.com/go-co-op/gocron/v2"
|
||||
gocron "github.com/andoma-go/gocron/v2"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
uuid "github.com/google/uuid"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user