cycle

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cycle

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

func InitCycle

func InitCycle(g *gin.Engine) (c *Cycle)

func New

func New(engine *gin.Engine) *Cycle

func (*Cycle) AddAfterRun

func (c *Cycle) AddAfterRun(afterRun func(*gin.Context)) *Cycle

add cron after func

func (*Cycle) AddBeforeRun

func (c *Cycle) AddBeforeRun(beforeRun func(*gin.Context) bool) *Cycle

add cron before func

func (*Cycle) AddFunc

func (c *Cycle) AddFunc(duration time.Duration, cmd func(*gin.Context) error)

func (*Cycle) Start

func (c *Cycle) Start()

type Entry

type Entry struct {
	Duration time.Duration
	Job      Job
}

type FuncJob

type FuncJob func(*gin.Context) error

func (FuncJob) Run

func (f FuncJob) Run(ctx *gin.Context) error

type Job

type Job interface {
	Run(ctx *gin.Context) error
}

Jump to

Keyboard shortcuts

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