task

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 13 Imported by: 0

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