xutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TD = "@daily" // 每天0点执行
View Source
const TH = "@hourly" // 每1小时执行
View Source
const TM = "@monthly" // 每月第一天的0点执行
View Source
const TM0217 = "0 8 17,2 * *" // 每月2号和17号早上8点执行
View Source
const TM15 = "0 0 15 * *" // 每月15号0点执行
View Source
const TS = "@every 1s" // 每秒执行
View Source
const TW = "@weekly" // 每周日开始的那个0点
View Source
const Tm = "@every 60s" // 每分钟执行

Variables

View Source
var JLog *log.Logger
View Source
var LogLevel = log.DebugLevel
View Source
var LogOnce sync.Once
View Source
var LogOut = os.Stdout

Functions

func Log

func Log() *log.Logger

func StartTimerTask

func StartTimerTask(taskName, timeStr string, taskFunc func())

StartTimerTask 定时任务,添加log和异常处理

Types

type MyJob

type MyJob struct {
	Name string
	// contains filtered or unexported fields
}

MyJob 定时任务工作

func (*MyJob) Run

func (that *MyJob) Run()

Run 开始执行的任务内容

type Worker

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

Worker define snowflake worker struct

func NewWorker

func NewWorker(workerId int64) *Worker

NewWorker new a worker

func (*Worker) GetId

func (w *Worker) GetId() int64

GetId get worker id

Jump to

Keyboard shortcuts

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