task

package
v1.42.17 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Registry = make(map[string][]*Task)
)

Functions

func Func

func Func(name string, fn interface{}) *delay.Function

Creates a new delay.Func which will call our fn with context.Context, etc.

func Names

func Names() []string

Returns a slice of task names

func Register

func Register(name string, tasks ...*Task) int

Register a new task in task registry

func Run

func Run(ctx *gin.Context, name string, args ...interface{})

Run task(s) associated with a given name

func SetupRoutes

func SetupRoutes(router router.Router)

Setup handlers for HTTP registered tasks

func Unregister

func Unregister(name string)

Remove tasks registered under a given name.

Types

type Delay

type Delay struct {
	Function *delay.Function
	Name     string
}

Details about a Task's delay function, if created with special task.Func helper

type Task

type Task struct {
	Name     string
	Number   int
	Value    reflect.Value
	Function interface{}
	Delay    *Delay
}

A Task which can be invoked later by name or HTTP handler

func New

func New(name string, fn interface{}) *Task

Create a new task and register it

Jump to

Keyboard shortcuts

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