gojobs

package module
v1.0.132 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 16 Imported by: 0

README

Golang

📦 Golang 任务

godoc goproxy.cn goreportcard.com deps.dev

安装

go get -v -u go.dtapp.net/gojobs@v1.0.132

Documentation

Index

Constants

View Source
const (
	// CodeAbnormal 异常
	CodeAbnormal = 0
	// CodeError 失败
	CodeError = http.StatusInternalServerError
	// CodeSuccess 成功
	CodeSuccess = http.StatusOK
	// CodeEnd 结束
	CodeEnd = http.StatusCreated
)
View Source
const (
	// TASK_IN 任务运行
	TASK_IN = "IN"
	// TASK_SUCCESS 任务完成
	TASK_SUCCESS = "SUCCESS"
	// TASK_ERROR 任务异常
	TASK_ERROR = "ERROR"
	// TASK_TIMEOUT 任务超时
	TASK_TIMEOUT = "TIMEOUT"
	// TASK_WAIT 任务等待
	TASK_WAIT = "WAIT"
)
View Source
const (
	SpecifyIpNull = "0.0.0.0"
)
View Source
const (
	Version = "1.0.132"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 实例

func NewClient

func NewClient(ctx context.Context, currentIP string) (*Client, error)

NewClient 创建实例

func (*Client) ConfigGormClientFun added in v1.0.120

func (c *Client) ConfigGormClientFun(ctx context.Context, client *gorm.DB, taskTableName string, taskLogStatus bool, taskLogTableName string) error

ConfigGormClientFun GORM配置

func (*Client) ConfigRedisClientFun added in v1.0.120

func (c *Client) ConfigRedisClientFun(ctx context.Context, client *redis.Client, lockKeyPrefix string, lockKeySeparator string, cornKeyPrefix string, cornKeyCustom string) error

ConfigRedisClientFun REDIS配置 lockKeyPrefix 锁Key前缀 xxx_lock lockKeySeparator 锁Key分隔符 : cornKeyPrefix 任务Key前缀 xxx_cron cornKeyCustom 任务Key自定义 xxx_cron_自定义 xxx_cron_自定义_*

func (*Client) CreateInCustomId added in v1.0.73

func (c *Client) CreateInCustomId(ctx context.Context, config *ConfigCreateInCustomId) error

CreateInCustomId 创建正在运行任务

func (*Client) CreateInCustomIdMaxNumber added in v1.0.73

func (c *Client) CreateInCustomIdMaxNumber(ctx context.Context, config *ConfigCreateInCustomIdMaxNumber) error

CreateInCustomIdMaxNumber 创建正在运行任务并限制数量

func (*Client) CreateInCustomIdMaxNumberOnly added in v1.0.73

func (c *Client) CreateInCustomIdMaxNumberOnly(ctx context.Context, config *ConfigCreateInCustomIdMaxNumberOnly) error

CreateInCustomIdMaxNumberOnly 创建正在运行唯一任务并限制数量

func (*Client) CreateInCustomIdOnly added in v1.0.73

func (c *Client) CreateInCustomIdOnly(ctx context.Context, config *ConfigCreateInCustomIdOnly) error

CreateInCustomIdOnly 创建正在运行唯一任务

func (*Client) CreateWaitCustomId added in v1.0.73

func (c *Client) CreateWaitCustomId(ctx context.Context, config *ConfigCreateWaitCustomId) error

CreateWaitCustomId 创建正在运行任务

func (*Client) EditTask added in v1.0.73

func (c *Client) EditTask(ctx context.Context, tx *gorm.DB, id uint) *gorm.DB

EditTask 任务修改

func (*Client) EndHandle added in v1.0.124

func (c *Client) EndHandle(ctx context.Context, key any)

func (*Client) Filter added in v1.0.114

func (c *Client) Filter(ctx context.Context, isMandatoryIp bool, specifyIp string, tasks []GormModelTask, isPrint bool) (newTasks []GormModelTask)

Filter 过滤 ctx 上下文 isMandatoryIp 强制当前ip specifyIp 指定Ip tasks 过滤前的数据 newTasks 过滤后的数据

func (*Client) GetCurrentIp added in v1.0.73

func (c *Client) GetCurrentIp() string

GetCurrentIp 获取当前IP

func (*Client) GetDb added in v1.0.73

func (c *Client) GetDb() *gorm.DB

GetDb 获取数据库驱动

func (*Client) GetGormDb added in v1.0.116

func (c *Client) GetGormDb() *gorm.DB

GetGormDb 获取数据库驱动

func (*Client) GetIssueAddress added in v1.0.73

func (c *Client) GetIssueAddress(ctx context.Context, workers []string, v *GormModelTask) (string, error)

GetIssueAddress 获取下发地址 workers 在线列表 v 任务信息 --- address 下发地址 err 错误信息

func (*Client) GetRedisDb added in v1.0.116

func (c *Client) GetRedisDb() *redis.Client

GetRedisDb 获取缓存数据库驱动

func (*Client) GetSubscribeAddress added in v1.0.73

func (c *Client) GetSubscribeAddress() string

GetSubscribeAddress 获取订阅地址

func (*Client) GetSubscribeClientList added in v1.0.73

func (c *Client) GetSubscribeClientList(ctx context.Context) (client []string, err error)

GetSubscribeClientList 获取在线的客户端

func (*Client) GormTaskLogDelete added in v1.0.98

func (c *Client) GormTaskLogDelete(ctx context.Context, hour int64) error

GormTaskLogDelete 删除

func (*Client) GormTaskLogErrorDelete added in v1.0.117

func (c *Client) GormTaskLogErrorDelete(ctx context.Context, hour int64) error

GormTaskLogErrorDelete 删除任务异常

func (*Client) GormTaskLogInDelete added in v1.0.117

func (c *Client) GormTaskLogInDelete(ctx context.Context, hour int64) error

GormTaskLogInDelete 删除任务运行

func (*Client) GormTaskLogRecord added in v1.0.106

func (c *Client) GormTaskLogRecord(ctx context.Context, task GormModelTask, runId string, taskResultCode int, taskResultDesc string)

GormTaskLogRecord 记录

func (*Client) GormTaskLogSuccessDelete added in v1.0.117

func (c *Client) GormTaskLogSuccessDelete(ctx context.Context, hour int64) error

GormTaskLogSuccessDelete 删除任务完成

func (*Client) GormTaskLogTimeoutDelete added in v1.0.117

func (c *Client) GormTaskLogTimeoutDelete(ctx context.Context, hour int64) error

GormTaskLogTimeoutDelete 删除任务超时

func (*Client) GormTaskLogWaitDelete added in v1.0.117

func (c *Client) GormTaskLogWaitDelete(ctx context.Context, hour int64) error

GormTaskLogWaitDelete 删除任务等待

func (*Client) Lock added in v1.0.73

func (c *Client) Lock(ctx context.Context, info GormModelTask, id any) (string, error)

Lock 上锁

func (*Client) LockCustomId added in v1.0.81

func (c *Client) LockCustomId(ctx context.Context, info GormModelTask) (string, error)

LockCustomId 上锁

func (*Client) LockForever added in v1.0.73

func (c *Client) LockForever(ctx context.Context, info GormModelTask, id any) (string, error)

LockForever 永远上锁

func (*Client) LockForeverCustomId added in v1.0.81

func (c *Client) LockForeverCustomId(ctx context.Context, info GormModelTask) (string, error)

LockForeverCustomId 永远上锁

func (*Client) LockForeverId added in v1.0.73

func (c *Client) LockForeverId(ctx context.Context, info GormModelTask) (string, error)

LockForeverId 永远上锁

func (*Client) LockId added in v1.0.73

func (c *Client) LockId(ctx context.Context, info GormModelTask) (string, error)

LockId 上锁

func (*Client) NewLock added in v1.0.95

func (c *Client) NewLock(task GormModelTask) (*TaskLockOperation, error)

func (*Client) PSubscribe added in v1.0.73

func (c *Client) PSubscribe(ctx context.Context) SubscribeResult

PSubscribe 订阅,支持通配符匹配(ch_user_*)

func (*Client) Println added in v1.0.114

func (c *Client) Println(ctx context.Context, isPrint bool, v ...any)

func (*Client) Publish added in v1.0.73

func (c *Client) Publish(ctx context.Context, channel string, message interface{}) error

Publish 发布 ctx 上下文 channel 频道 message 消息

func (*Client) Run added in v1.0.73

func (c *Client) Run(ctx context.Context, task GormModelTask, taskResultCode int, taskResultDesc string)

Run 运行

func (*Client) SetDebug added in v1.0.124

func (c *Client) SetDebug()

SetDebug 设置调试模式

func (*Client) StartCronClean added in v1.0.118

func (c *Client) StartCronClean(ctx context.Context, cr *cron.Cron, cp string, hour int64) (cron.EntryID, error)

StartCronClean 定时清理任务日志

func (*Client) StartHandle added in v1.0.124

func (c *Client) StartHandle(ctx context.Context, key any, overdue int64) error

func (*Client) StartTask added in v1.0.73

func (c *Client) StartTask(ctx context.Context, tx *gorm.DB, id uint) error

StartTask 任务启动

func (*Client) StartTaskCustom added in v1.0.73

func (c *Client) StartTaskCustom(ctx context.Context, tx *gorm.DB, customId string, customSequence int64) error

StartTaskCustom 任务启动自定义

func (*Client) Subscribe added in v1.0.73

func (c *Client) Subscribe(ctx context.Context) SubscribeResult

Subscribe 订阅

func (*Client) TaskFindAll added in v1.0.73

func (c *Client) TaskFindAll(ctx context.Context, tx *gorm.DB, frequency int64) (results []GormModelTask)

TaskFindAll 查询多任务

func (*Client) TaskFindAllError added in v1.0.73

func (c *Client) TaskFindAllError(ctx context.Context, tx *gorm.DB, frequency int64) []GormModelTask

TaskFindAllError 查询多任务 - 任务异常

func (*Client) TaskFindAllErrorType added in v1.0.114

func (c *Client) TaskFindAllErrorType(ctx context.Context, tx *gorm.DB, Type string) []GormModelTask

TaskFindAllErrorType 查询多任务 - 任务异常

func (*Client) TaskFindAllIn added in v1.0.73

func (c *Client) TaskFindAllIn(ctx context.Context, tx *gorm.DB, frequency int64) []GormModelTask

TaskFindAllIn 查询多任务 - 任务运行

func (*Client) TaskFindAllInType added in v1.0.114

func (c *Client) TaskFindAllInType(ctx context.Context, tx *gorm.DB, Type string) []GormModelTask

TaskFindAllInType 查询多任务 - 任务运行

func (*Client) TaskFindAllSuccess added in v1.0.73

func (c *Client) TaskFindAllSuccess(ctx context.Context, tx *gorm.DB, frequency int64) []GormModelTask

TaskFindAllSuccess 查询多任务 - 任务完成

func (*Client) TaskFindAllSuccessType added in v1.0.114

func (c *Client) TaskFindAllSuccessType(ctx context.Context, tx *gorm.DB, Type string) []GormModelTask

TaskFindAllSuccessType 查询多任务 - 任务完成

func (*Client) TaskFindAllTimeout added in v1.0.73

func (c *Client) TaskFindAllTimeout(ctx context.Context, tx *gorm.DB, frequency int64) []GormModelTask

TaskFindAllTimeout 查询多任务 - 任务超时

func (*Client) TaskFindAllTimeoutType added in v1.0.114

func (c *Client) TaskFindAllTimeoutType(ctx context.Context, tx *gorm.DB, Type string) []GormModelTask

TaskFindAllTimeoutType 查询多任务 - 任务超时

func (*Client) TaskFindAllType added in v1.0.114

func (c *Client) TaskFindAllType(ctx context.Context, tx *gorm.DB, Type string, frequency int64) (results []GormModelTask)

TaskFindAllType 查询多任务

func (*Client) TaskFindAllWait added in v1.0.73

func (c *Client) TaskFindAllWait(ctx context.Context, tx *gorm.DB, frequency int64) []GormModelTask

TaskFindAllWait 查询多任务 - 任务等待

func (*Client) TaskFindAllWaitType added in v1.0.114

func (c *Client) TaskFindAllWaitType(ctx context.Context, tx *gorm.DB, Type string) []GormModelTask

TaskFindAllWaitType 查询多任务 - 任务等待

func (*Client) TaskTake added in v1.0.73

func (c *Client) TaskTake(ctx context.Context, tx *gorm.DB, customId string) (result GormModelTask)

TaskTake 自定义编号查询任务

func (*Client) TaskTakeError added in v1.0.73

func (c *Client) TaskTakeError(ctx context.Context, tx *gorm.DB, customId string) GormModelTask

TaskTakeError 查询单任务 - 任务异常

func (*Client) TaskTakeId added in v1.0.73

func (c *Client) TaskTakeId(ctx context.Context, tx *gorm.DB, id uint) (result GormModelTask)

TaskTakeId 编号查询任务

func (*Client) TaskTakeIn added in v1.0.73

func (c *Client) TaskTakeIn(ctx context.Context, tx *gorm.DB, customId string) GormModelTask

TaskTakeIn 查询单任务 - 任务运行

func (*Client) TaskTakeSuccess added in v1.0.73

func (c *Client) TaskTakeSuccess(ctx context.Context, tx *gorm.DB, customId string) GormModelTask

TaskTakeSuccess 查询单任务 - 任务完成

func (*Client) TaskTakeTimeout added in v1.0.73

func (c *Client) TaskTakeTimeout(ctx context.Context, tx *gorm.DB, customId string) GormModelTask

TaskTakeTimeout 查询单任务 - 任务超时

func (*Client) TaskTakeWait added in v1.0.73

func (c *Client) TaskTakeWait(ctx context.Context, tx *gorm.DB, customId string) GormModelTask

TaskTakeWait 查询单任务 - 任务等待

func (*Client) TaskTypeTake added in v1.0.73

func (c *Client) TaskTypeTake(ctx context.Context, tx *gorm.DB, customId, Type string) (result GormModelTask)

TaskTypeTake 查询单任务

func (*Client) TaskTypeTakeError added in v1.0.73

func (c *Client) TaskTypeTakeError(ctx context.Context, tx *gorm.DB, customId, Type string) GormModelTask

TaskTypeTakeError 查询单任务 - 任务异常

func (*Client) TaskTypeTakeIn added in v1.0.73

func (c *Client) TaskTypeTakeIn(ctx context.Context, tx *gorm.DB, customId, Type string) GormModelTask

TaskTypeTakeIn 查询单任务 - 任务运行

func (*Client) TaskTypeTakeSuccess added in v1.0.73

func (c *Client) TaskTypeTakeSuccess(ctx context.Context, tx *gorm.DB, customId, Type string) GormModelTask

TaskTypeTakeSuccess 查询单任务 - 任务完成

func (*Client) TaskTypeTakeTimeout added in v1.0.73

func (c *Client) TaskTypeTakeTimeout(ctx context.Context, tx *gorm.DB, customId, Type string) GormModelTask

TaskTypeTakeTimeout 查询单任务 - 任务超时

func (*Client) TaskTypeTakeWait added in v1.0.73

func (c *Client) TaskTypeTakeWait(ctx context.Context, tx *gorm.DB, customId, Type string) GormModelTask

TaskTypeTakeWait 查询单任务 - 任务等待

func (*Client) Unlock added in v1.0.73

func (c *Client) Unlock(ctx context.Context, info GormModelTask, id any) error

Unlock Lock 解锁

func (*Client) UnlockCustomId added in v1.0.81

func (c *Client) UnlockCustomId(ctx context.Context, info GormModelTask) error

UnlockCustomId 解锁

func (*Client) UnlockId added in v1.0.73

func (c *Client) UnlockId(ctx context.Context, info GormModelTask) error

UnlockId 解锁

func (*Client) UpdateFrequency added in v1.0.73

func (c *Client) UpdateFrequency(ctx context.Context, tx *gorm.DB, id uint, frequency int64) error

UpdateFrequency 更新任务频率

type ConfigCreateInCustomId

type ConfigCreateInCustomId struct {
	Tx             *gorm.DB // 驱动
	Params         string   // 参数
	Frequency      int64    // 频率(秒单位)
	CustomId       string   // 自定义编号
	CustomSequence int64    // 自定义顺序
	Type           string   // 类型
	TypeName       string   // 类型名称
	SpecifyIp      string   // 指定外网IP
	CurrentIp      string   // 当前外网IP
}

ConfigCreateInCustomId 创建正在运行任务

type ConfigCreateInCustomIdMaxNumber

type ConfigCreateInCustomIdMaxNumber struct {
	Tx             *gorm.DB // 驱动
	Params         string   // 参数
	Frequency      int64    // 频率(秒单位)
	MaxNumber      int64    // 最大次数
	CustomId       string   // 自定义编号
	CustomSequence int64    // 自定义顺序
	Type           string   // 类型
	TypeName       string   // 类型名称
	SpecifyIp      string   // 指定外网IP
	CurrentIp      string   // 当前外网IP
}

ConfigCreateInCustomIdMaxNumber 创建正在运行任务并限制数量

type ConfigCreateInCustomIdMaxNumberOnly

type ConfigCreateInCustomIdMaxNumberOnly struct {
	Tx             *gorm.DB // 驱动
	Params         string   // 参数
	Frequency      int64    // 频率(秒单位)
	MaxNumber      int64    // 最大次数
	CustomId       string   // 自定义编号
	CustomSequence int64    // 自定义顺序
	Type           string   // 类型
	TypeName       string   // 类型名称
	SpecifyIp      string   // 指定外网IP
	CurrentIp      string   // 当前外网IP
}

ConfigCreateInCustomIdMaxNumberOnly 创建正在运行唯一任务并限制数量

type ConfigCreateInCustomIdOnly

type ConfigCreateInCustomIdOnly struct {
	Tx             *gorm.DB // 驱动
	Params         string   // 参数
	Frequency      int64    // 频率(秒单位)
	CustomId       string   // 自定义编号
	CustomSequence int64    // 自定义顺序
	Type           string   // 类型
	TypeName       string   // 类型名称
	SpecifyIp      string   // 指定外网IP
	CurrentIp      string   // 当前外网IP
}

ConfigCreateInCustomIdOnly 创建正在运行唯一任务

type ConfigCreateWaitCustomId added in v1.0.66

type ConfigCreateWaitCustomId struct {
	Tx             *gorm.DB // 驱动
	Params         string   // 参数
	Frequency      int64    // 频率(秒单位)
	CustomId       string   // 自定义编号
	CustomSequence int64    // 自定义顺序
	Type           string   // 类型
	TypeName       string   // 类型名称
	SpecifyIp      string   // 指定外网IP
	CurrentIp      string   // 当前外网IP
}

ConfigCreateWaitCustomId 创建正在运行任务

type Cron

type Cron struct {
	// contains filtered or unexported fields
}

Cron 定时任务管理器

func NewCron

func NewCron(opts ...CronOption) *Cron

NewCron 创建一个定时任务管理器

func NewCronWithSeconds added in v1.0.125

func NewCronWithSeconds(opts ...CronOption) *Cron

func (*Cron) AddFunc added in v1.0.125

func (c *Cron) AddFunc(spec string, cmd func()) (cron.EntryID, error)

AddFunc 添加任务

func (*Cron) AddJob added in v1.0.126

func (c *Cron) AddJob(spec string, cmd cron.Job) (cron.EntryID, error)

AddJob 添加任务

func (*Cron) AddTask added in v1.0.127

func (c *Cron) AddTask(name string, spec string, cmd func()) (cron.EntryID, error)

AddTask 添加任务

func (*Cron) Entry added in v1.0.126

func (c *Cron) Entry(id cron.EntryID) cron.Entry

Entry 查询任务

func (*Cron) GetDrive added in v1.0.126

func (c *Cron) GetDrive() *cron.Cron

GetDrive 获取驱动

func (*Cron) List added in v1.0.125

func (c *Cron) List() []cron.EntryID

List 任务列表

func (*Cron) ListShow added in v1.0.125

func (c *Cron) ListShow()

ListShow 任务列表

func (*Cron) ListTask added in v1.0.127

func (c *Cron) ListTask()

ListTask 任务列表

func (*Cron) PrintNameTask added in v1.0.130

func (c *Cron) PrintNameTask(id cron.EntryID, name string, content ...string)

PrintNameTask 日志任务

func (*Cron) PrintTask added in v1.0.128

func (c *Cron) PrintTask(id cron.EntryID, content ...string)

PrintTask 日志任务

func (*Cron) QueryInfo added in v1.0.130

func (c *Cron) QueryInfo(id cron.EntryID) (cron.EntryID, string)

QueryInfo 查询信息

func (*Cron) QueryTask added in v1.0.127

func (c *Cron) QueryTask(id cron.EntryID) cron.Entry

QueryTask 查询任务

func (*Cron) Remove added in v1.0.126

func (c *Cron) Remove(id cron.EntryID)

Remove 删除任务

func (*Cron) RemoveTask added in v1.0.127

func (c *Cron) RemoveTask(id cron.EntryID)

RemoveTask 删除任务

func (*Cron) RunListShow added in v1.0.128

func (c *Cron) RunListShow(spec string)

RunListShow 任务列表

func (*Cron) RunListTask added in v1.0.128

func (c *Cron) RunListTask(spec string)

RunListTask 任务列表

func (*Cron) Start

func (c *Cron) Start()

Start 启动任务

func (*Cron) Stop

func (c *Cron) Stop() context.Context

Stop 关闭任务

type CronOption added in v1.0.128

type CronOption func(*Cron)

func WithCronLog added in v1.0.128

func WithCronLog() CronOption

WithCronLog 日志

type GormModelTask added in v1.0.121

type GormModelTask struct {
	ID             uint           `gorm:"primaryKey;comment:记录编号" json:"id"`                      // 记录编号
	Status         string         `gorm:"index;comment:状态码" json:"status"`                        // 状态码
	Params         string         `gorm:"comment:参数" json:"params"`                               // 参数
	StatusDesc     string         `gorm:"comment:状态描述" json:"status_desc"`                        // 状态描述
	Frequency      int64          `gorm:"index;comment:频率(秒单位)" json:"frequency"`                 // 频率(秒单位)
	Number         int64          `gorm:"comment:当前次数" json:"number"`                             // 当前次数
	MaxNumber      int64          `gorm:"comment:最大次数" json:"max_number"`                         // 最大次数
	RunID          string         `gorm:"comment:执行编号" json:"run_id"`                             // 执行编号
	CustomID       string         `gorm:"index;comment:自定义编号" json:"custom_id"`                   // 自定义编号
	CustomSequence int64          `gorm:"comment:自定义顺序" json:"custom_sequence"`                   // 自定义顺序
	Type           string         `gorm:"index;comment:类型" json:"type"`                           // 类型
	TypeName       string         `gorm:"comment:类型名称" json:"type_name"`                          // 类型名称
	CreatedIP      string         `gorm:"default:0.0.0.0;comment:创建外网IP" json:"created_ip"`       // 创建外网IP
	SpecifyIP      string         `gorm:"default:0.0.0.0;index;comment:指定外网IP" json:"specify_ip"` // 指定外网IP
	UpdatedIP      string         `gorm:"default:0.0.0.0;comment:更新外网IP" json:"updated_ip"`       // 更新外网IP
	Result         string         `gorm:"comment:结果" json:"result"`                               // 结果
	NextRunTime    time.Time      `gorm:"comment:下次运行时间" json:"next_run_time"`                    // 下次运行时间
	CreatedAt      time.Time      `gorm:"autoCreateTime;comment:创建时间" json:"created_at"`          // 创建时间
	UpdatedAt      time.Time      `gorm:"autoUpdateTime;comment:更新时间" json:"updated_at"`          // 更新时间
	DeletedAt      gorm.DeletedAt `gorm:"index;comment:删除时间" json:"deleted_at"`                   // 删除时间
}

GormModelTask 任务

type GormModelTaskLog added in v1.0.121

type GormModelTaskLog struct {
	LogID           uint      `gorm:"primaryKey;comment:【日志】编号" json:"log_id"`                            // 【日志】编号
	LogTime         time.Time `gorm:"autoCreateTime;index;comment:【日志】时间" json:"log_time"`                // 【日志】时间
	TaskID          uint      `gorm:"index;comment:【任务】编号" json:"task_id"`                                // 【任务】编号
	TaskRunID       string    `gorm:"comment:【任务】执行编号" json:"task_run_id"`                                //【任务】执行编号
	TaskResultCode  int       `gorm:"index;comment:【任务】执行状态码" json:"task_result_code"`                    //【任务】执行状态码
	TaskResultDesc  string    `gorm:"comment:【任务】执行结果" json:"task_result_desc"`                           //【任务】执行结果
	SystemInsideIP  string    `gorm:"default:0.0.0.0;comment:【系统】内网IP" json:"system_inside_ip,omitempty"` //【系统】内网IP
	SystemOutsideIP string    `gorm:"default:0.0.0.0;comment:【系统】外网IP" json:"system_outside_ip"`          //【系统】外网IP
}

GormModelTaskLog 任务日志

type Hour added in v1.0.126

type Hour struct {
	// contains filtered or unexported fields
}

Hour 每天n点执行一次

func GetHour

func GetHour(n int64) *Hour

GetHour 每天n点执行一次

func (Hour) Frequency added in v1.0.126

func (s Hour) Frequency() int64

Frequency 每天n点执行一次

func (Hour) Spec added in v1.0.126

func (s Hour) Spec() string

Spec 每天n点执行一次

type HourInterval added in v1.0.126

type HourInterval struct {
	// contains filtered or unexported fields
}

HourInterval 每隔n小时执行一次

func GetHourInterval

func GetHourInterval(n int64) *HourInterval

GetHourInterval 每隔n小时执行一次

func (HourInterval) Frequency added in v1.0.126

func (s HourInterval) Frequency() int64

Frequency 每隔n小时执行一次

func (HourInterval) Spec added in v1.0.126

func (s HourInterval) Spec() string

Spec 每隔n小时执行一次

type Minutes added in v1.0.126

type Minutes struct {
	// contains filtered or unexported fields
}

Minutes 每隔n分钟执行一次

func GetMinutes

func GetMinutes(n int64) *Minutes

GetMinutes 每隔n分钟执行一次

func (Minutes) Frequency added in v1.0.126

func (s Minutes) Frequency() int64

Frequency 每隔n分钟执行一次

func (Minutes) Spec added in v1.0.126

func (s Minutes) Spec() string

Spec 每隔n分钟执行一次

type Seconds added in v1.0.117

type Seconds struct {
	// contains filtered or unexported fields
}

Seconds 每隔n秒执行一次

func GetSeconds

func GetSeconds(n int64) *Seconds

GetSeconds 每隔n秒执行一次

func (Seconds) Frequency added in v1.0.117

func (s Seconds) Frequency() int64

Frequency 每隔n秒执行一次

func (Seconds) Spec added in v1.0.117

func (s Seconds) Spec() string

Spec 每隔n秒执行一次

type SubscribeResult added in v1.0.44

type SubscribeResult struct {
	Message *redis.PubSub
	// contains filtered or unexported fields
}

type TaskLockOperation added in v1.0.95

type TaskLockOperation struct {
	// contains filtered or unexported fields
}

func (*TaskLockOperation) Lock added in v1.0.95

func (tlo *TaskLockOperation) Lock(ctx context.Context, id any) error

Lock 上锁

func (*TaskLockOperation) LockCustomId added in v1.0.95

func (tlo *TaskLockOperation) LockCustomId(ctx context.Context) error

LockCustomId 上锁

func (*TaskLockOperation) LockForever added in v1.0.95

func (tlo *TaskLockOperation) LockForever(ctx context.Context, id any) error

LockForever 永远上锁

func (*TaskLockOperation) LockForeverCustomId added in v1.0.95

func (tlo *TaskLockOperation) LockForeverCustomId(ctx context.Context) error

LockForeverCustomId 永远上锁

func (*TaskLockOperation) LockForeverId added in v1.0.95

func (tlo *TaskLockOperation) LockForeverId(ctx context.Context) error

LockForeverId 永远上锁

func (*TaskLockOperation) LockId added in v1.0.95

func (tlo *TaskLockOperation) LockId(ctx context.Context) error

LockId 上锁

func (*TaskLockOperation) Unlock added in v1.0.95

func (tlo *TaskLockOperation) Unlock(ctx context.Context, id any) error

Unlock 解锁

func (*TaskLockOperation) UnlockCustomId added in v1.0.95

func (tlo *TaskLockOperation) UnlockCustomId(ctx context.Context) error

UnlockCustomId 解锁

func (*TaskLockOperation) UnlockId added in v1.0.95

func (tlo *TaskLockOperation) UnlockId(ctx context.Context) error

UnlockId 解锁

Jump to

Keyboard shortcuts

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