Skip to content

Commit 5dcee74

Browse files
committed
1.schedule:新增方法,2.更新README,3.将根目录的资源文件移动到static目录
1 parent 9fe3263 commit 5dcee74

File tree

11 files changed

+38
-8
lines changed

11 files changed

+38
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<h1><img src="./sailboat-solid-colorful.svg" alt="sailboat-solid" title="sailboat-solid" width="300" /></h1>
2+
<h1><img src="static/sailboat-solid-colorful.svg" alt="sailboat-solid" title="sailboat-solid" width="300" /></h1>
33
</div>
44

55
[![Go](https://github.com/keepchen/go-sail/actions/workflows/go.yml/badge.svg)](https://github.com/keepchen/go-sail/actions/workflows/go.yml) [![CodeQL](https://github.com/keepchen/go-sail/actions/workflows/codeql.yml/badge.svg)](https://github.com/keepchen/go-sail/actions/workflows/codeql.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/keepchen/go-sail/v3)](https://goreportcard.com/report/github.com/keepchen/go-sail/v3)
@@ -46,7 +46,7 @@ sail.WakeupHttp("go-sail", conf).
4646
```
4747
当你看到终端如下图所示内容就表示服务启动成功了:
4848

49-
<img src="./launch.png" alt="launch.png" title="launch.png" width="600" />
49+
<img src="static/launch.png" alt="launch.png" title="launch.png" width="600" />
5050

5151
## 文档
5252
[文档传送门](https://blog.keepchen.com/a/go-sail.html?from=github)

README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<h1><img src="./sailboat-solid-colorful.svg" alt="sailboat-solid" title="sailboat-solid" width="300" /></h1>
2+
<h1><img src="static/sailboat-solid-colorful.svg" alt="sailboat-solid" title="sailboat-solid" width="300" /></h1>
33
</div>
44

55
[![Go](https://github.com/keepchen/go-sail/actions/workflows/go.yml/badge.svg)](https://github.com/keepchen/go-sail/actions/workflows/go.yml) [![CodeQL](https://github.com/keepchen/go-sail/actions/workflows/codeql.yml/badge.svg)](https://github.com/keepchen/go-sail/actions/workflows/codeql.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/keepchen/go-sail/v3)](https://goreportcard.com/report/github.com/keepchen/go-sail/v3)
@@ -46,7 +46,7 @@ sail.WakeupHttp("go-sail", conf).
4646
```
4747
Console screenshot after launched like this:
4848

49-
<img src="./launch.png" alt="launch.png" title="launch.png" width="600" />
49+
<img src="static/launch.png" alt="launch.png" title="launch.png" width="600" />
5050

5151
## Documentation
5252
[Docs](https://blog.keepchen.com/a/go-sail.html?from=github)

schedule/crontabexpr.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ package schedule
33
// 一些常用的crontab表达式
44
const (
55
EveryMinute = "* * * * *" //每分钟的开始第0秒
6+
EveryFiveMinute = "*/5 * * * *" //每5分钟的开始第0秒
7+
EveryTenMinute = "*/10 * * * *" //每10分钟的开始第0秒
8+
EveryFifteenMinute = "*/15 * * * *" //每15分钟的开始第0秒
9+
EveryTwentyMinute = "*/20 * * * *" //每20分钟的开始第0秒
10+
EveryThirtyMinute = "*/30 * * * *" //每30分钟的开始第0秒
11+
EveryFortyFiveMinute = "*/45 * * * *" //每45分钟的开始第0秒
612
FirstDayOfMonth = "0 0 1 * *" //每月的第一天的0点0分
713
LastDayOfMonth = "0 0 L * *" //每月的最后一天的0点0分
814
FirstDayOfWeek = "0 0 * * 1" //每周的第一天(周一)的0点0分
File renamed without changes.

schedule/interval.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ func (j *taskJob) EveryTenSeconds() (cancel CancelFunc) {
102102
return
103103
}
104104

105+
// EveryFifteenSeconds 每15秒执行一次
106+
func (j *taskJob) EveryFifteenSeconds() (cancel CancelFunc) {
107+
j.setInterval(time.Second * 15).run()
108+
109+
cancel = j.cancelFunc
110+
111+
return
112+
}
113+
105114
// EveryTwentySeconds 每20秒执行一次
106115
func (j *taskJob) EveryTwentySeconds() (cancel CancelFunc) {
107116
j.setInterval(time.Second * 20).run()
@@ -138,6 +147,15 @@ func (j *taskJob) EveryFiveMinutes() (cancel CancelFunc) {
138147
return
139148
}
140149

150+
// EveryFifteenMinutes 每15分钟执行一次
151+
func (j *taskJob) EveryFifteenMinutes() (cancel CancelFunc) {
152+
j.setInterval(time.Minute * 15).run()
153+
154+
cancel = j.cancelFunc
155+
156+
return
157+
}
158+
141159
// EveryTenMinutes 每10分钟执行一次
142160
func (j *taskJob) EveryTenMinutes() (cancel CancelFunc) {
143161
j.setInterval(time.Minute * 10).run()
@@ -201,7 +219,7 @@ func (j *taskJob) EveryTwentyHours() (cancel CancelFunc) {
201219
return
202220
}
203221

204-
// Daily 每天执行一次
222+
// Daily 每天执行一次(每24小时)
205223
func (j *taskJob) Daily() (cancel CancelFunc) {
206224
j.setInterval(time.Hour * 24).run()
207225

schedule/schedule.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ type Scheduler interface {
3333
EveryFiveSeconds() (cancel CancelFunc)
3434
// EveryTenSeconds 每10秒执行一次
3535
EveryTenSeconds() (cancel CancelFunc)
36+
// EveryFifteenSeconds 每15秒执行一次
37+
EveryFifteenSeconds() (cancel CancelFunc)
3638
// EveryTwentySeconds 每20秒执行一次
3739
EveryTwentySeconds() (cancel CancelFunc)
3840
// EveryThirtySeconds 每30秒执行一次
@@ -43,6 +45,8 @@ type Scheduler interface {
4345
EveryFiveMinutes() (cancel CancelFunc)
4446
// EveryTenMinutes 每10分钟执行一次
4547
EveryTenMinutes() (cancel CancelFunc)
48+
// EveryFifteenMinutes 每15分钟执行一次
49+
EveryFifteenMinutes() (cancel CancelFunc)
4650
// EveryTwentyMinutes 每20分钟执行一次
4751
EveryTwentyMinutes() (cancel CancelFunc)
4852
// EveryThirtyMinutes 每30分钟执行一次
@@ -55,24 +59,24 @@ type Scheduler interface {
5559
EveryTenHours() (cancel CancelFunc)
5660
// EveryTwentyHours 每20小时执行一次
5761
EveryTwentyHours() (cancel CancelFunc)
58-
// Daily 每天执行一次
62+
// Daily 每天执行一次(每24小时)
5963
Daily() (cancel CancelFunc)
6064
// Weekly 每周执行一次(每7天)
6165
Weekly() (cancel CancelFunc)
6266
// Monthly 每月执行一次(每30天)
6367
Monthly() (cancel CancelFunc)
6468
// Yearly 每年执行一次(每365天)
6569
Yearly() (cancel CancelFunc)
66-
6770
// RunAfter 在一定时间后执行
6871
//
6972
// # Note
7073
//
7174
// 这是一个一次性任务,不会重复执行
7275
RunAfter(delay time.Duration) (cancel CancelFunc)
73-
7476
// RunAt 在某一时刻执行
7577
//
78+
//重复地在某个时间点执行任务
79+
//
7680
// crontabExpr Linux crontab风格的表达式
7781
//
7882
// * * * * *

schedule/specs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99

1010
// RunAt 在某一时刻执行
1111
//
12+
// 重复地在某个时间点执行任务
13+
//
1214
// crontabExpr Linux crontab风格的表达式
1315
//
1416
// * * * * *
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)