process

package
v3.8.1-rc.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConditions added in v3.8.1

func AddConditions(p *Process, condition ...bool)

func WrapFunc

func WrapFunc(f func()) func(ctx context.Context) error

WrapFunc wrap common func

Types

type Process added in v3.8.1

type Process struct {
	Tasks []*Task

	// Only all RunCondition is true, process will exec tasks.
	RunConditions []bool
	// contains filtered or unexported fields
}

func NewProcess added in v3.8.1

func NewProcess() *Process

func (*Process) AddConditions added in v3.8.1

func (p *Process) AddConditions(condition ...bool)

func (*Process) AddTasks added in v3.8.1

func (p *Process) AddTasks(task ...*Task)

func (*Process) Clear added in v3.8.1

func (p *Process) Clear()

func (*Process) ContinueExec added in v3.8.1

func (p *Process) ContinueExec() error

func (*Process) Exec added in v3.8.1

func (p *Process) Exec() error

func (*Process) ExecOffset added in v3.8.1

func (p *Process) ExecOffset(offset int) error

func (*Process) GetTaskNum added in v3.8.1

func (p *Process) GetTaskNum() int

func (*Process) ResetConditions added in v3.8.1

func (p *Process) ResetConditions(condition ...bool)

func (*Process) SetContext added in v3.8.1

func (p *Process) SetContext(ctx context.Context)

type Task added in v3.8.1

type Task struct {
	ShouldRun    bool  // determine if task will run
	Func         any   // must be func. run funcs
	Args         []any // func args
	NegativeFunc any   // must be func. if !ShouldRun, will run this
	NegativeArgs []any // negative args
}

func NewTask added in v3.8.1

func NewTask(shouldRun bool, f any, args ...any) *Task

func (*Task) AddNegativeFunc added in v3.8.1

func (t *Task) AddNegativeFunc(f any, args ...any) *Task

Jump to

Keyboard shortcuts

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