schedule

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: MIT Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JobHistoryAdaptor = core.NewChanAdaptor[JobHistory](1000)
View Source
var JobHistoryEnabled = true
View Source
var LockerTimeout = time.Hour
View Source
var ScheduleDisabled = false
View Source
var ScheduleLockerEnabled = true

Functions

func CheckIfEnabled added in v0.8.6

func CheckIfEnabled() cron.JobWrapper

func CreateSchedule

func CreateSchedule(jobname, schedule string, cmd func(), opts ...ScheduleOptions) error

func CreateScheduledJob added in v0.11.5

func CreateScheduledJob(jobname, schedule string, cmd func() error, opts ...ScheduleOptions) error

func DoCleanup added in v0.8.0

func DoCleanup(settingkey string, tables []string, col string, duration string) interface{}

func InitDBCronJob added in v0.8.0

func InitDBCronJob(logger *zap.Logger, db *gorm.DB) (core.Startup, error)

func InitScheduleCleanupJob added in v0.8.0

func InitScheduleCleanupJob(settingkey string) interface{}

func List added in v0.10.7

func List() []string

func Run added in v0.10.1

func Run(jobname string) (err error)

func Withhistory added in v0.8.1

func Withhistory(jobname string) cron.JobWrapper

decrepted, will be removed next release.

Types

type CleanupService added in v0.8.0

type CleanupService struct {
	DBMap map[string]*gorm.DB
	// contains filtered or unexported fields
}

func (*CleanupService) Cleanup added in v0.8.0

func (cs *CleanupService) Cleanup(req *DBCleanupReq) error

func (*CleanupService) GetDefaultRequest added in v0.8.0

func (cs *CleanupService) GetDefaultRequest() *DBCleanupReq

func (*CleanupService) RegConnection added in v0.8.0

func (cs *CleanupService) RegConnection(name string, db *gorm.DB)

type DBCleanupReq added in v0.8.0

type DBCleanupReq struct {
	Cnn            string   //connection name
	Tables         []string //tables to be clean
	PrefixIncluded bool     // table names included table prefix
	DeletedField   string   //field name, default is deletedAt
	Duration       string   // only delete DeletedAt <  now - duration
	Batch          int      // batch per deleted
}

type DBCronJob added in v0.8.0

type DBCronJob struct {
	Name     string
	Schedule string
	Sql      []string
	Logger   *zap.Logger
	DB       *gorm.DB
}

func (*DBCronJob) FireJob added in v0.8.0

func (job *DBCronJob) FireJob()

type JobHistory added in v0.8.1

type JobHistory struct {
	App      string
	Job      string
	Start    time.Time
	Finished time.Time
	Duration time.Duration
	Succeed  bool
	Message  string
}

func GetLastDoneJobHistory added in v0.10.6

func GetLastDoneJobHistory(jobname string) *JobHistory

type JobHistoryProvider added in v0.10.6

type JobHistoryProvider struct {
	Bus       EventBus.Bus
	Persister cache.Hash
}

func (*JobHistoryProvider) GetLastDoneJobHistory added in v0.10.6

func (p *JobHistoryProvider) GetLastDoneJobHistory(jobname string) *JobHistory

func (*JobHistoryProvider) SetJobhistory added in v0.10.6

func (p *JobHistoryProvider) SetJobhistory(h JobHistory)

type ScheduleLoker added in v0.7.7

type ScheduleLoker struct {
	Locker  locker.Locker
	Jobname string
}

func (*ScheduleLoker) Wrapper added in v0.7.7

func (sl *ScheduleLoker) Wrapper() cron.JobWrapper

type ScheduleOptions added in v0.10.18

type ScheduleOptions struct {
	Nolocker  bool
	NoGlobal  bool // ignore ScheduleDisabled
	NoHistory bool
}

Jump to

Keyboard shortcuts

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