execute

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package execute

Package execute

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	// Logger 设置logger
	Logger(logger log.Log)
	// Clear 清除已有任务
	Clear()
	// Empty 判断是否有任务
	Empty() bool
	// Count 获取任务数量
	Count() int
	// AddFixed 添加需要执行的任务,函数必须为:executorFunc
	AddFixed(f executorFunc, param ...interface{}) Executor
	// AddFlexible 推荐此方法, 参数可以为空,返回值必须是:any, error,其中 any 可以是 interface 或者其他自定义类型
	// 添加任务,函数格式必须为:
	//    taskfunc(param ...interface{}) (interface{}, error)
	//    或自定义参数
	//    taskfunc(i int, s string, arr []int) (interface{}, error)
	AddFlexible(f interface{}, param ...interface{}) Executor
	// Execute 执行任务,返回任务结果,不返回任务error以及执行error
	Execute(ctx context.Context) ([]interface{}, error)
	// ExecuteWithErr 执行任务,返回任务结果和任务error以及执行error
	ExecuteWithErr(ctx context.Context) ([]interface{}, []error, error)
}

func NewExecutor

func NewExecutor(taskName string) Executor

Jump to

Keyboard shortcuts

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