schedule

package
v1.0.1006 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUNDAY    = "0"
	MONDAY    = "1"
	TUESDAY   = "2"
	WEDNESDAY = "3"
	THURSDAY  = "4"
	FRIDAY    = "5"
	SATURDAY  = "6"
)

常量

Variables

View Source
var (
	// New
	NewCron = cron.New

	// 设置
	WithLocation = cron.WithLocation
	WithSeconds  = cron.WithSeconds
	WithParser   = cron.WithParser
	WithChain    = cron.WithChain
	WithLogger   = cron.WithLogger

	// 解析
	NewParser     = cron.NewParser
	ParseStandard = cron.ParseStandard

	// Chain
	NewChain            = cron.NewChain
	Recover             = cron.Recover
	DelayIfStillRunning = cron.DelayIfStillRunning
	SkipIfStillRunning  = cron.SkipIfStillRunning

	// Every
	Every = cron.Every

	// 日志
	DefaultLogger = cron.DefaultLogger
	DiscardLogger = cron.DiscardLogger

	PrintfLogger        = cron.PrintfLogger
	VerbosePrintfLogger = cron.VerbosePrintfLogger
)

Functions

This section is empty.

Types

type Chain

type Chain = cron.Chain

结构体

type ConstantDelaySchedule

type ConstantDelaySchedule = cron.ConstantDelaySchedule

结构体

type Cron

type Cron = cron.Cron

结构体

type CronEntry

type CronEntry = cron.Entry

结构体

type CronEntryID

type CronEntryID = cron.EntryID

结构体

type CronLogger

type CronLogger = cron.Logger

结构体

type Entry

type Entry struct {
	// 计划时间
	Spec string

	// Schedule
	Schedule ISchedule

	// 脚本
	Cmd any

	// 当前任务名称
	Name string
}

*

  • 计划任务内容,任务时间用的最低秒 *
  • @create 2022-11-29
  • @author deatil

func NewEntry

func NewEntry() *Entry

构造函数

func (*Entry) AddFunc

func (this *Entry) AddFunc(cmd func()) *Entry

函数

func (*Entry) AddJob

func (this *Entry) AddJob(cmd IJob) *Entry

Job 接口类

func (*Entry) AddSchedule

func (this *Entry) AddSchedule(schedule ISchedule, cmd IJob) *Entry

Schedule

func (*Entry) At

func (this *Entry) At(time string) *Entry

func (*Entry) Cron

func (this *Entry) Cron(spec string) *Entry

设置计划时间

func (*Entry) CronAnnually

func (this *Entry) CronAnnually() *Entry

annually

func (*Entry) CronDaily

func (this *Entry) CronDaily() *Entry

daily

func (*Entry) CronHourly

func (this *Entry) CronHourly() *Entry

hourly

func (*Entry) CronMidnight

func (this *Entry) CronMidnight() *Entry

midnight

func (*Entry) CronMonthly

func (this *Entry) CronMonthly() *Entry

monthly

func (*Entry) CronWeekly

func (this *Entry) CronWeekly() *Entry

weekly

func (*Entry) CronYearly

func (this *Entry) CronYearly() *Entry

Yearly

func (*Entry) Daily

func (this *Entry) Daily() *Entry

func (*Entry) DailyAt

func (this *Entry) DailyAt(time string) *Entry

func (*Entry) Days

func (this *Entry) Days(days ...string) *Entry

days

func (*Entry) Every

func (this *Entry) Every(date string) *Entry

every

func (*Entry) EveryFifteenMinutes

func (this *Entry) EveryFifteenMinutes() *Entry

func (*Entry) EveryFifteenSeconds

func (this *Entry) EveryFifteenSeconds() *Entry

func (*Entry) EveryFiveMinutes

func (this *Entry) EveryFiveMinutes() *Entry

func (*Entry) EveryFiveSeconds

func (this *Entry) EveryFiveSeconds() *Entry

func (*Entry) EveryFourHours

func (this *Entry) EveryFourHours() *Entry

func (*Entry) EveryFourMinutes

func (this *Entry) EveryFourMinutes() *Entry

func (*Entry) EveryFourSeconds

func (this *Entry) EveryFourSeconds() *Entry

func (*Entry) EveryMinute

func (this *Entry) EveryMinute() *Entry

func (*Entry) EverySecond

func (this *Entry) EverySecond() *Entry

func (*Entry) EverySixHours

func (this *Entry) EverySixHours() *Entry

func (*Entry) EveryTenMinutes

func (this *Entry) EveryTenMinutes() *Entry

func (*Entry) EveryTenSeconds

func (this *Entry) EveryTenSeconds() *Entry

func (*Entry) EveryThirtyMinutes

func (this *Entry) EveryThirtyMinutes() *Entry

func (*Entry) EveryThirtySeconds

func (this *Entry) EveryThirtySeconds() *Entry

func (*Entry) EveryThreeHours

func (this *Entry) EveryThreeHours() *Entry

func (*Entry) EveryThreeMinutes

func (this *Entry) EveryThreeMinutes() *Entry

func (*Entry) EveryThreeSeconds

func (this *Entry) EveryThreeSeconds() *Entry

func (*Entry) EveryTwoHours

func (this *Entry) EveryTwoHours() *Entry

func (*Entry) EveryTwoMinutes

func (this *Entry) EveryTwoMinutes() *Entry

func (*Entry) EveryTwoSeconds

func (this *Entry) EveryTwoSeconds() *Entry

func (*Entry) Fridays

func (this *Entry) Fridays() *Entry

func (*Entry) Hourly

func (this *Entry) Hourly() *Entry

func (*Entry) HourlyAt

func (this *Entry) HourlyAt(offset ...string) *Entry

func (*Entry) Mondays

func (this *Entry) Mondays() *Entry

func (*Entry) Monthly

func (this *Entry) Monthly() *Entry

func (*Entry) MonthlyOn

func (this *Entry) MonthlyOn(dayOfMonth, time string) *Entry

func (*Entry) Quarterly

func (this *Entry) Quarterly() *Entry

func (*Entry) Saturdays

func (this *Entry) Saturdays() *Entry

func (*Entry) SpliceIntoPosition

func (this *Entry) SpliceIntoPosition(position uint, value string) *Entry

更改位置

func (*Entry) Sundays

func (this *Entry) Sundays() *Entry

func (*Entry) Thursdays

func (this *Entry) Thursdays() *Entry

func (*Entry) Tuesdays

func (this *Entry) Tuesdays() *Entry

func (*Entry) TwiceDaily

func (this *Entry) TwiceDaily(first, second string) *Entry

func (*Entry) TwiceDailyAt

func (this *Entry) TwiceDailyAt(first, second, offset string) *Entry

func (*Entry) TwiceMonthly

func (this *Entry) TwiceMonthly(first, second, time string) *Entry

func (*Entry) Wednesdays

func (this *Entry) Wednesdays() *Entry

func (*Entry) Weekdays

func (this *Entry) Weekdays() *Entry

func (*Entry) Weekends

func (this *Entry) Weekends() *Entry

func (*Entry) Weekly

func (this *Entry) Weekly() *Entry

func (*Entry) WeeklyOn

func (this *Entry) WeeklyOn(dayOfWeek, time string) *Entry

func (*Entry) WithCmd

func (this *Entry) WithCmd(cmd any) *Entry

设置脚本

func (*Entry) WithName added in v1.0.1002

func (this *Entry) WithName(name string) *Entry

设置名称

func (*Entry) WithSpec

func (this *Entry) WithSpec(spec string) *Entry

设置计划时间

func (*Entry) Yearly

func (this *Entry) Yearly() *Entry

func (*Entry) YearlyOn

func (this *Entry) YearlyOn(month, dayOfMonth, time string) *Entry

type IFuncJob

type IFuncJob = cron.FuncJob

接口

type IJob

type IJob = cron.Job

接口

type ISchedule

type ISchedule = cron.Schedule

接口

type JobWrapper

type JobWrapper = cron.JobWrapper

结构体

type Logger

type Logger struct{}

*

  • 日志 *
  • @create 2022-12-2
  • @author deatil

func NewLogger

func NewLogger() Logger

构造函数

func (Logger) Printf

func (this Logger) Printf(msg string, v ...any)

实现接口

type Option

type Option = cron.Option

结构体

type Parser

type Parser = cron.Parser

结构体

type Schedule

type Schedule struct {

	// 计划任务
	Cron *Cron
	// contains filtered or unexported fields
}

*

  • 计划任务 *
  • @create 2022-11-29
  • @author deatil

func New

func New() *Schedule

构造函数

func (*Schedule) AddFunc

func (this *Schedule) AddFunc(cmd func()) *Entry

AddFunc

func (*Schedule) AddJob

func (this *Schedule) AddJob(cmd IJob) *Entry

AddJob

func (*Schedule) AddSchedule

func (this *Schedule) AddSchedule(schedule ISchedule, cmd IJob) *Entry

AddSchedule

func (*Schedule) ClearEntries

func (this *Schedule) ClearEntries() *Schedule

清空数据

func (*Schedule) CronEntries added in v1.0.1002

func (this *Schedule) CronEntries() []CronEntry

计划任务已添加任务列表

func (*Schedule) CronEntry added in v1.0.1002

func (this *Schedule) CronEntry(name string) CronEntry

计划任务已添加单个任务

func (*Schedule) CronID added in v1.0.1002

func (this *Schedule) CronID(name string) CronEntryID

计划任务单个 ID

func (*Schedule) CronIDNames added in v1.0.1002

func (this *Schedule) CronIDNames() []string

计划任务名称列表

func (*Schedule) CronIDs

func (this *Schedule) CronIDs() map[string]CronEntryID

计划任务 ID 列表

func (*Schedule) CronLocation added in v1.0.1002

func (this *Schedule) CronLocation() *time.Location

任务时区

func (*Schedule) CronRemove added in v1.0.1002

func (this *Schedule) CronRemove(name string)

任务删除

func (*Schedule) CronStart added in v1.0.1002

func (this *Schedule) CronStart(name string)

任务开启

func (*Schedule) CronStop added in v1.0.1002

func (this *Schedule) CronStop(name string)

任务停止

func (*Schedule) Entries added in v1.0.1002

func (this *Schedule) Entries() []*Entry

全部任务数据

func (*Schedule) GetEntry added in v1.0.1002

func (this *Schedule) GetEntry(name string) *Entry

获取数据

func (*Schedule) RemoveEntry added in v1.0.1002

func (this *Schedule) RemoveEntry(name string)

移除数据

func (*Schedule) Run

func (this *Schedule) Run()

运行

func (*Schedule) SetLocation

func (this *Schedule) SetLocation(loc string) *Schedule

设置时区

func (*Schedule) SetShowLogInfo

func (this *Schedule) SetShowLogInfo(logInfo bool) *Schedule

设置日志

func (*Schedule) Start

func (this *Schedule) Start()

开启

func (*Schedule) Stop

func (this *Schedule) Stop() context.Context

停止

func (*Schedule) WithCron

func (this *Schedule) WithCron(c *Cron) *Schedule

添加计划任务

func (*Schedule) WithEntry

func (this *Schedule) WithEntry(entry *Entry) *Schedule

添加数据

func (*Schedule) WithOption

func (this *Schedule) WithOption(opts ...Option) *Schedule

批量设置

type SpecSchedule

type SpecSchedule = cron.SpecSchedule

结构体

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL