taskx

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

* @Author: hugo * @Date: 2024-05-10 15:06 * @LastEditors: hugo * @LastEditTime: 2024-05-17 16:48 * @FilePath: \gotox\taskx\taskx.go * @Description: * * Copyright (c) 2024 by hugo, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l logx.Logger)

// 自定义的logger,建议实例化赋予

Types

type Task

type Task interface {
	Name() string
	// task with context, run in new goroutine, context is canceled when interrupt
	Run(context.Context)
}

type Taskx

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

func NewTaskx

func NewTaskx(name string, fn func(ctx context.Context)) *Taskx

func (*Taskx) Name

func (t *Taskx) Name() string

func (*Taskx) Run

func (t *Taskx) Run(ctx context.Context)

type TaskxGroup

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

func NewTaskxGroup

func NewTaskxGroup() *TaskxGroup

func (*TaskxGroup) AddTask

func (t *TaskxGroup) AddTask(tasks ...Task)

func (*TaskxGroup) Run

func (t *TaskxGroup) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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