global

package
v0.0.0-...-540b577 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GOENVDev  = "dev"  // 开发环境
	GOENVProd = "prod" // 生产环境
)

Variables

View Source
var DeferTaskQueue []*DeferTask

DeferTaskQueue 延迟任务队列

Functions

This section is empty.

Types

type Application

type Application struct {
	Config           config.Configuration
	Log              *zap.Logger
	Engine           *gin.Engine
	MongoDB          *mongo.Client
	TiDB             *sql.DB
	Redis            *redis.Client
	WebSocketManager *ws.WebSocketManager
	MQChannel        *amqp.Channel
}

type DeferTask

type DeferTask struct {
	Function func(...any)
	Params   []any
}

DeferTask 释放资源

func NewDeferTask

func NewDeferTask(f func(...any), params ...any) *DeferTask

NewDeferTask 创建资源释放任务

func (*DeferTask) Execute

func (t *DeferTask) Execute()

type DelayTask

type DelayTask struct {
	Function func(...any)
	Params   []any
	Time     time.Duration
}

DelayTask 延迟任务

func NewDelayTask

func NewDelayTask(f func(...any), t time.Duration, params []any) *DelayTask

NewDelayTask 创建延迟任务

func (*DelayTask) Execute

func (t *DelayTask) Execute()

type PeriodTask

type PeriodTask struct {
	Function func(...any)
	Params   []any
	Time     time.Duration // TaskTypeDelay => 多长时间后执行; TaskTypeDefer => 无效; TaskTypePeriod => 执行的周期
}

PeriodTask 周期任务

func NewPeriodTask

func NewPeriodTask(f func(...any), t time.Duration, params []any) *PeriodTask

NewPeriodTask 创建周期任务

func (*PeriodTask) Execute

func (t *PeriodTask) Execute()

type Task

type Task interface {
	Execute()
}

Jump to

Keyboard shortcuts

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