cron

package
v0.0.0-...-9dac4f2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: BSD-2-Clause, MIT Imports: 8 Imported by: 0

Documentation

Overview

Package base 基类

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultCronLogger

func NewDefaultCronLogger(logger log.Logger, opts ...Option) interface{ Printf(string, ...interface{}) }

NewDefaultCronLogger 创建定时日志

Types

type Base

type Base struct {
}

Base 定时任务基础类

func (*Base) Enable

func (b *Base) Enable() bool

Enable 是否启用

type Config

type Config struct {
	Enable bool `json:"enable,omitempty"`
	Debug  bool `json:"debug,omitempty"`
}

Config 配置

func (*Config) GetDebug

func (x *Config) GetDebug() bool

func (*Config) GetEnable

func (x *Config) GetEnable() bool

type ICornServer

type ICornServer interface {
	transport.Server
}

ICornServer 定时标准

func NewCronServer

func NewCronServer(
	conf *Config,
	log log.Logger,
	jobs ...ICron,
) ICornServer

NewCronServer 创建 定时任务

type ICron

type ICron interface {
	// Spec 任务计划
	Spec() string
	// Run 任务
	Run(ctx context.Context) func()
}

ICron 任务标准

type Option

type Option func(os *options)

func WithIsError

func WithIsError(isError bool) Option

type Timer

type Timer struct {
	Spec string `json:"spec,omitempty"`
}

func (*Timer) GetSpec

func (x *Timer) GetSpec() string

Jump to

Keyboard shortcuts

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