gotask

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

gotask

task for go

fmt.Println(_FnCost(func() {
    Debug = false

    _fn := TaskOf(func(i int) {
        //fmt.Println(i)
        _T(i == 90999, "90999 error")
    }, func(err error) {
        _Throw(err)
    })

    var task = NewTask(500, time.Second+time.Millisecond*10)
    for i := 0; i < 100000; i++ {
        if err := task.Do(_fn, i); err != nil {
            fmt.Println(err)
            break
        }
    }

    task.Wait()
}))

Documentation

Index

Constants

View Source
const Version = "v0.0.10"

Variables

View Source
var Cfg = struct {
	Debug bool
}{
	Debug: true,
}

Functions

func GetTask added in v0.0.10

func GetTask(name string) (tsk *internal.TaskFnDef)

func GetTasks added in v0.0.10

func GetTasks() map[string]*internal.TaskFnDef

func TaskRegistry added in v0.0.10

func TaskRegistry(name string, fn interface{})

Types

type Task

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

func NewTask

func NewTask(max int, maxDur time.Duration) *Task

func (*Task) Do

func (t *Task) Do(fName string, args ...interface{})

func (*Task) Len added in v0.0.2

func (t *Task) Len() int

func (*Task) Stat added in v0.0.10

func (t *Task) Stat() internal.Stat

func (*Task) Wait

func (t *Task) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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